Windows forms designer is not supported for project targeting net core

In Visual Studio 2019 Preview 1, there is no project template for generating .NET Core 3 WinForms projects. If I instead run on the command line: dotnet new winforms -o winforms_core_test a project...

Comments

@bobasaurus

@karelz
karelz

changed the title
VS2019 .Net Core 3 WinForms Designer Support Missing?

WinForms Designer Support

Dec 4, 2018

@karelz
karelz

added
the

enhancement

Product code improvement that does NOT require public API changes/additions

label

Dec 4, 2018

@wjk
wjk

mentioned this issue

Sep 3, 2019

@RussKie
RussKie

added

area: VS designer

Windows Forms out-of-proc designer related issues

and removed

enhancement

Product code improvement that does NOT require public API changes/additions

labels

Sep 25, 2019

@msftbot
msftbot
bot

locked as resolved and limited conversation to collaborators

Feb 8, 2022

Olia Gavrysh e1538680748374

designer

Don’t forget to enable the designer in Tools > Options > Environment > Preview Features.

Содержание

  1. How to use the designer
  2. What’s available in the designer
  3. What’s coming next
  4. New in 16.6 GA release
  5. New in 16.7 Preview 1 release
  6. Known issue
  7. Give us your feedback!
  8. 4 Answers 4
  9. Comments
  10. davkean commented May 1, 2017
  11. davkean commented May 1, 2017
  12. davkean commented May 1, 2017
  13. davkean commented May 1, 2017
  14. davkean commented May 1, 2017
  15. danmoseley commented May 1, 2017
  16. coderb commented Jun 8, 2018 •
  17. terrajobst commented Jun 8, 2018
  18. coderb commented Jun 8, 2018 •
  19. terrajobst commented Jun 8, 2018
  20. Pilchie commented Jun 8, 2018
  21. w4mmp commented Feb 4, 2020
  22. davkean commented Feb 4, 2020
  23. w4mmp commented Feb 4, 2020
  24. tmeschter commented Dec 4, 2020
  25. .NET Standard 2.0
  26. .NET Standard 2.1
  27. .NET Core 3.1
  28. .NET 5
  29. Пробное использование помощника по обновлению
  30. Предварительные требования
  31. Consider
  32. Резервное копирование проектов
  33. Пакеты NuGet
  34. Файл проекта
  35. Ресурсы и параметры
  36. Visual Basic
  37. Перезагрузка проекта
  38. Изменение файла App.config
  39. Добавление пакета совместимости
  40. Тестирование приложения
  41. Windows forms designer is not supported for project targeting net core
  42. Asked by:
  43. Question
  44. All replies

How to use the designer

settings

Improving the performance is our next goal after we complete the functionality work, so don’t get upset if it’s not as fast as you envisioned while the designer is in the preview, that’s something we will improve in the future.

Currently the new Windows Forms designer works only on Windows 10.

What’s available in the designer

What’s coming next

This work is in progress, and you already can see some results in the Visual Studio 16.7 Preview 1 designer.

progress grid

New in 16.6 GA release

New in 16.7 Preview 1 release

Known issue

Some users might not see some controls (like Button, CheckBox, etc.) in the Toolbox. That happens due to the Toolbox cache corruption issue that will be fixed in the next version. Meanwhile, there is a simple way to fix it on your machine:

This should fix the problem.

Give us your feedback!

Источник

Please check in the image that I’m getting during the opening project.:

WVkAY

ytrd4

photo

4 Answers 4

Preview VS2019 until v16.4 needs a VSIX separate installation extension. Now you can update your Preview of VS2019 (to 16.5 or higher) and you don’t need this extension. You can do it through the menu «Help» of VS IDE.

Restart VS and it will work 😉

You can install the Preview Version that will have all these and more feature enabled. As its a preview it may be unstable but it can run side by side with your normal version in case something is broken in preview

AOlCX

Make sure you only have the form declared in your file. If you have more than one class defined, the design viewer will not work.

plz select Windows Forms App(.NETFrameworke) instead of Windows Forms App(.NET Core) in creation wizard.

Just go to View > Solution Explorer. There you will see your form. Double click it and you will have the form designer.

I think Visual Studio when loading a project loads the tab that was opened last time project was closed. If form code was open when project was closed, the project opens in form code.

Источник

From @JinShil on April 29, 2017 7:47

However, if one tries to use these classes in the current release of Visual Studio 2017 to create designers for their classes, Visual Studio displays errors in the designer like

In Visual Studio, right-click on the «Class1.cs» node and choose «View Designer».

Could not load file or assembly ‘System.ComponentModel.Primitives, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

Copied from original issue: dotnet/corefx#19139

The text was updated successfully, but these errors were encountered:

From @karelz on April 29, 2017 8:12

If VS changes are needed (which is IMO likely), there will be accompanying VS update.

From @danmosemsft on April 30, 2017 0:20

From @weshaggard on May 1, 2017 17:13

From @karelz on May 1, 2017 18:13

Seems to be answered by @weshaggard, closing. Please let us know if you need more info (we can reopen again), thanks!

i’ve got a winforms app that references a project library that is dual targeted to net452 and netstandard2.0 (via netstandard2.0;net452 ) and the forms designer shows the exception page with the error:

Could not load file or assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file specified.

The referenced library has no winforms dependencies. Removing netstandard2.0 from the TargetFrameworks makes the designer work again.

This seems like a bug in VS.

Have you tried changing this:

@davkean would know more but my understanding is that the pieces in VS that aren’t aware of multi-targeting will use the first framework in that list.

@terrajobst ack. YES it did fix it (i needed to rebuild the project / restart VS). Thank you!

Oops, didn’t mean to close this.

Hello,
This is the closest thing I have found that I believe relates to an issue I have when attempting to run a dotnet core 3.1 application. After porting an existing Window Forms application to dotnet 3.1 I receive this when attempting to run the application:
G:Ham RadioominaSDRHardwareLinuxdotnettestmsccReleasenetcoreapp3.1>dotnet mscc.dll
Unhandled exception. System.Resources.MissingManifestResourceException: Could not find the resource «OmniaGUI.Main_form.resources» among the resources «mscc.Properties.Resources.resources» embedded in the assembly «mscc», nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at System.Resources.ResourceManager.GetString(String name)
at OmniaGUI.Main_form.InitializeComponent() in G:Ham RadioominaSDRHardwareLinuxdotnettestmsccMain_Form.designer.cs:line 1403
at OmniaGUI.Main_form..ctor() in G:Ham RadioominaSDRHardwareLinuxdotnettestmsccMain_Form.cs:line 105
at OmniaGUI.Program.Main() in G:Ham RadioominaSDRHardwareLinuxdotnettestmsccProgram.cs:line 20

Since I am 100% new to dotnet core, it is most likely an issue with my port, but I am at a lost on how to correct the issue.
Regard,s
Ron

P.S. I am not intentionally attempting to high jack this thread, but really looks like a good place to start. Please let me know if I should start new issue.

Hello,
Thanks for getting back to me so quickly. I will start a new issue in msbuild.
Cheers,
Ron

.NET Standard 2.0

The designer «opens» with the white screen of death and the error «Unsupported type argument in custom attribute signature». Call stack:

.NET Standard 2.1

.NET Core 3.1

You get an «Opening the file. » dialog for a few seconds, and then nothing—the designer doesn’t open at all.

.NET 5

You get an «Opening the file. » dialog for a few seconds, and then nothing—the designer doesn’t open at all.

Источник

Пробное использование помощника по обновлению

Предварительные требования

Предварительная версия конструктора WinForms в Visual Studio.

В этой статье используется пример приложения Matching game. Если вы хотите в точности выполнять инструкции данной статьи, скачайте и откройте это приложение в Visual Studio. В противном случае используйте собственное приложение.

Consider

Удостоверьтесь, что ваше приложение подходит для переноса.

Вы используете другую версию Windows Forms.

Обновите пакеты NuGet, используемые в проекте.

Рекомендуется обновить пакеты NuGet до последней версии перед переносом. Если ваше приложение ссылается на пакеты NuGet, обновите их до последней версии. Убедитесь, что сборка приложения выполняется успешно. Если после обновления возникают ошибки пакетов, установите предыдущую версию пакетов, которая не нарушает работу вашего кода.

Резервное копирование проектов

Пакеты NuGet

Чтобы перенести файл packages.config, выполните следующие действия.

Будет создан отчет о сборке, из которого вы сможете узнать о любых проблемах переноса пакетов NuGet.

Файл проекта

Преобразуйте каждый проект в вашем решении. Если вы используете упомянутый выше пример приложения, то необходимо преобразовать проекты MatchingGame и MatchingGame.Logic.

Чтобы преобразовать проект, выполните следующие действия.

В обозревателе решений найдите проект, который требуется перенести.

Щелкните проект правой кнопкой мыши и выберите Выгрузить проект.

Щелкните проект правой кнопкой мыши и выберите Изменить файл проекта.

Скопируйте XML-код проекта и вставьте его в текстовый редактор. Копия нужна, чтобы было проще переместить содержимое в новый проект.

Очистите содержимое файла и вставьте следующий XML-код:

Этот XML-код представляет базовую структуру проекта. Однако в нем нет никаких параметров из старого файла проекта. Используя старые сведения о проекте, скопированные ранее в текстовый редактор, выполните следующие действия.

Скопируйте следующие элементы из старого файла проекта в элемент

в новом файле проекта:

Теперь XML-код в файле проекта должен выглядеть следующим образом:

, и вставьте их в новый файл после закрывающего тега

Теперь XML-код в файле проекта должен выглядеть следующим образом:

не нужны дочерние элементы

Ресурсы и параметры

Проекты Windows Forms могут также ссылаться на следующие файлы:

Ваш проект ссылается на файл app.manifest автоматически, и никаких специальных действий для его миграции не требуется.

Импортируйте конфигурацию для файла Settings.settings.

В проектах Visual Basic файл параметров проекта обычно по умолчанию находится в папке My Project, а в проектах C# — в папке Properties.

В проектах Visual Basic файл ресурсов проекта обычно по умолчанию находится в папке My Project, а в проектах C# — в папке Properties.

Visual Basic

Для проектов на языке Visual Basic требуется дополнительная настройка.

Добавьте параметр WindowsForms в элемент

Импортируйте пространства имен, определенные в вашем проекте.

Скопируйте параметры и из исходного проекта в элемент

Перезагрузка проекта

После преобразования проекта в новый формат в стиле пакета SDK перезагрузите проект в Visual Studio, выполнив следующие действия.

В обозревателе решений найдите преобразованный вами проект.

Щелкните проект правой кнопкой мыши и выберите Перезагрузить проект.

Если проект не загружается, возможно, вы допустили ошибку в XML-коде проекта. Откройте файл проекта для редактирования и попробуйте найти и исправить ошибку. Если не удается найти ошибку, попробуйте начать заново.

Изменение файла App.config

Если в вашем приложении имеется файл App.config, удалите элемент :

Добавление пакета совместимости

Если файл проекта загружается правильно, но его компиляция завершается неудачно, появляется сообщение об ошибке, подобное приведенному ниже.

Измените файл проекта, добавив в него следующий элемент :

Тестирование приложения

После завершения переноса приложения протестируйте его!

Источник

Windows forms designer is not supported for project targeting net core

HeaderFooterSprite

HeaderFooterSprite

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

trans

Asked by:

trans

Question

trans

trans

I’ve recently updated VS 2019 16.3.1 and am trying to develop a project that:

Visual Studio fails to load a designer to be used for the Windows app.

In addition, I’m trying to develop this app and use the recently updated ML.Net that will take advantage of SQLite.

No designer showing/available.

trans

trans

Thank you for posting here.

Any feedback will be expected.

MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

trans

trans

Maybe it is only implemented for WPF.

trans

trans

According to docs. NET Core 3.0 is downloaded with the Visual Studio Update 16.3.1

trans

trans

I want to use a Winforms because The ML.NET SDK with Model Builder is now available.

trans

trans

Sorry for delay in reply.

MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

trans

trans

Could not load file or assembly ‘System.ComponentModel.Primitives, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

trans

trans

Sorry for delay in reply.

I have installed the extension in lastest version of VS2019 community and enterprise, the winform designer(.NET Core) both works normally. And this error is a known issue in previous version.

So I’m sorry that you need to reqpair or reinstall visual studio 2019 on your machine, and sorry for this inconvenience.

Источник

For the WinForms project you can refer to this video

How to fix WinForms Designer not support .net core 3.0 visual studio 2019

Since this video give more details we need, we can be followed step by step. It is also based on Microsoft official github project dotnet/winforms

dotnet/winforms — Using the Classic WinForms Designer in WinForms Core

The related code (VS project) made by me is already pushed to github:

.netCore-WinForms_Designer

For the WPF project you can use XAML Designer as below:

Workaround to use the designer in WPF Core App

Reference:

dotnet/samples — WPF Hello World sample with linked files

Install vs 2019 Professional/Enterprise version

Firstly, you need to Install vs 2019 Professional/Enterprise version. Then installing .net core 3.0 SDK is needed. Now you can try to create a .net core WPF application,

1555775855179

After setting the relevant project name and storage path, it will pop up:

img2-BravoYeung

Check «Use preview SDK» under .NET core in VS options

After setting done, restart vs to take effect.

Use VS build-in template, create WPF Project named «CoreHiWPF» of .net core

1555775855179

1555775915106

Under the created solution, use VS build-in template to create new WPF project «HiWPF» of .net framework type

1555775957478

1555775984667

Now the file structure of the solution is below:

1555776045894

Update Assembly Name of .net core WPF «CoreHiWPF», make Assembly Names of two projects are the same

Right click the project CoreHiWPF, select Properties, then change its Assembly Name to HiWPF.

1555773128801

Then right click the project, click «Edit CoreHiWPF.csproj».

1555773253120

Add code as below:

1555773381960

  <ItemGroup>
    <ApplicationDefinition Include="..HiWPFApp.xaml" Link="App.xaml">
      <Generator>MSBuild:Compile</Generator>
    </ApplicationDefinition>
    <Compile Include="..HiWPFApp.xaml.cs" Link="App.xaml.cs" />
  </ItemGroup>

  <ItemGroup>
    <Page Include="..HiWPFMainWindow.xaml" Link="MainWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Compile Include="..HiWPFMainWindow.xaml.cs" Link="MainWindow.xaml.cs" />
  </ItemGroup>

Ensure .net core WPF project CoreHiWPF is set as start up project

If the .net core WPF project CoreHiWPF is already highlighted, you can ignore then. Or, you need to select project CoreHiWPF, then right click Set As Start up project.

Try XAML Designer

Now close all opened files. Click the file MainWindow.xaml of project HiWPF. Then you can see empty WPF window in XAML designer now.

1555773860860

Modify the file MainWindow.xaml and related .cs if needed

Then, I add two lines to Grid of the file MainWindow.xaml:
— One line is a Label which support Wrap
— The other line is a Exit button.

Then I added the Click event to Exit button, added the Loaded event to Window.

modify

After finish updating code, press F5 to run, the final UI is below:

1555774408266

The code is also already pushed to github:

.netCore-WPF_Designer .

You can clone it directly to have a look.

0 / 0 / 0

Регистрация: 17.03.2022

Сообщений: 20

1

04.07.2022, 18:43. Показов 1218. Ответов 3


Всем привет
Подскажите, пожалуйста. С VS перешел на RIDER
Но при открытии конструктора форм Win Forms выдает ошибку, что конструктор форм не поддерживается
Версия RIDER 2022.1.2. Вроде как конструктор в этой версии уже есть
Гуглинг не помог
Нужен плагин какой-то или это баг?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

04.07.2022, 18:43

Ответы с готовыми решениями:

HDD IDE Win 7
Здарова.
Из 3.5 HDD сделал внешний, с помощью переходника USB to IDE. Установил на HDD этот…

IDE под Win 64
Подскажите?

Не появляется конструктор Windows Forms
Доброго времени суток!
При создании нового проекта Windows Forms не появляется Конструктор формы….

Win Forms
Есть готовый проект, работающий через cmd.exe, как прикрутить к нему интерфейс — форму? Если можно,…

с++ Win forms
подскажите,в windows forms поставил скролл бар,скомпилировал ,а оно не реагирует,и ещё,как…

3

Эксперт .NET

16746 / 12498 / 3285

Регистрация: 17.09.2011

Сообщений: 20,732

04.07.2022, 19:32

2

Цитата
Сообщение от Si02
Посмотреть сообщение

при открытии конструктора форм Win Forms выдает ошибку, что конструктор форм не поддерживается…

… в проектах под .NET Core

Цитата
Сообщение от Si02
Посмотреть сообщение

Нужен плагин какой-то или это баг?

Вы, похоже, сообщение до конца не дочитали.
В проектах под .NET Framework работает в указанной вами версии.



0



0 / 0 / 0

Регистрация: 17.03.2022

Сообщений: 20

04.07.2022, 19:40

 [ТС]

3

kolorotur, дочитал, но версия IDE последняя и насколько сказал гугл, то конструктор должен работать в ней



0



Эксперт .NET

16746 / 12498 / 3285

Регистрация: 17.09.2011

Сообщений: 20,732

04.07.2022, 20:30

4

Лучший ответ Сообщение было отмечено Si02 как решение

Решение

Цитата
Сообщение от Si02
Посмотреть сообщение

версия IDE последняя и насколько сказал гугл, то конструктор должен работать в ней

Конструктор работает только с проектами под платформу .NET Framework, под .NET Core/5/6 не работает.
Не верьте гуглу в таких вещах — проверяйте открытые тикеты на сайте разработчика JetBrains: Support WinForms Designer for .NET Core.
Тикет до сих пор не закрыт.



1



September 30th, 2019

Introducing .NET Core Windows Forms Designer Preview 1

We just released a GA version of .NET Core 3.0 that includes support for Windows Forms and WPF. And along with that release we’re happy to announce the first preview version of the Windows Forms Designer for .NET Core projects!

For developers the .NET Core Windows Forms Designer (when we will release the GA version) will look and feel the same as the .NET Framework Windows Forms Designer. But for us it is a huge technical challenge to bring the designer to .NET Core because it requires the design surface that hosts the live .NET Core form to run outside the Visual Studio process. That means we need to re-architect the way the designer surface “communicates” with Visual Studio. You can watch these communications in the Output Window, where we track each request sent when the Visual Studio components are accessing properties or executing methods on the live controls in the design surface. The engineering team is still working on this technical challenge, and we will be releasing the Preview versions on regular basis to give you the early glance at the .NET Core Designer. Stay tuned! The next Preview will be coming out in early November.

Because this is the very first preview of the designer, it isn’t yet bundled with Visual Studio and instead is available as a Visual Studio extension (“VSIX”) (download). That means that if you open a Windows Forms project targeting .NET Core in Visual Studio, it won’t have the designer support by default – you need to install the .NET Core Designer first!

Enabling the designer

To enable the designer, download and install the Windows Forms .NET Core Designer VSIX package. You can remove it from Visual Studio at any time. After you install the .NET Core Designer, Visual Studio will automatically pick the right designer (.NET Core or .NET Framework) depending on the target framework of the project you’re working on.

  • Download
  • Release Notes
  • Known Issues

It is early days for the designer, here is what to expect…

Please keep in mind, that this is the first preview, so the experience is limited. We support the most commonly used controls and base operations and will be adding more in each new Preview version. Eventually, we will bring the .NET Core Designer at parity with the Windows Forms Designer for .NET Framework.

Because many controls aren’t yet supported in Preview 1 of the designer, we don’t recommend porting your Windows Forms applications to .NET Core just yet if you need to use the designer on a regular basis. This Preview 1 is good for “Hello World” scenarios of creating new projects with common controls.

Controls included in Preview 1:

  • Pointer
  • Button
  • Checkbox
  • CheckedListBox
  • ComboBox
  • DateTimePicker
  • Label
  • LinkLabel
  • ListBox
  • ListView
  • MaskedTextBox
  • MonthCalendar
  • NumericUpDown
  • PictureBox
  • ProgressBar
  • RadioButton
  • RichTextBox
  • TextBox
  • TreeView

What is not supported in Preview 1:

  • Container
  • Resources
  • Component Tray
  • In-place editing
  • Designer Actions
  • Databinding
  • User Controls/Inherited Controls

Give us your feedback!

We are putting out our first bits so early to support the culture of developing the product with our users’ early feedback in mind. Please do reach out with your suggestions, issues and feature requests via Visual Studio Feedback channel. To do so, click on Send Feedback icon in Visual Studio top right corner as it is shown on the picture below.

We appreciate your engagement!

Addressing Questions

What to do if Windows Forms Designer doesn’t work?

We heard some question related to the Windows Forms Designer not working. Here’s what could have happened:

  1. You might have created a .NET Core Windows Forms project instead of the traditional .NET Framework one without realizing it. If you type “WinForms” or “Windows Forms” in the New Project Dialog, the first option would be a .NET Core Windows Forms project. If your intention is to create a .NET Framework project (with the mature designer support), just find and select Windows Forms App (.NET Framework).

  2. If you want to work with .NET Core project, don’t forget to install the .NET Core Windows Forms Designer, since it isn’t yet shipped inside Visual Studio by default. See the previous “Enabling the designer” section.

Does .NET Core WPF Designer depend on Windows Forms Designer installation?

We also received some questions related to the .NET Core WPF Designer not working and if it requires a separate installation or the Windows Forms Designer installation. No, the WPF Designer is completely independent of the Windows Forms Designer. We released its GA version of the WPF .NET Core Designer at the same time as .NET Core 3.0 and it comes with Visual Studio. In Visual Studio version 16.3.0 we had an issue with the Enable XAML Designer property set to false by default. That means that when you click on .xaml files, the designer doesn’t open automatically. Upgrade to the latest Visual Studio version 16.3.1 where this issue is fixed. Another option to fix it is to go to Tools -> Options -> XAML Designer and check Enable XAML Designer.

RRS feed

  • Remove From My Forums
  • Question

  • I’ve recently updated VS 2019 16.3.1 and am trying to develop a project that:

    Creates a Win Forms app that uses .NET 3 Core and C#.

    Visual Studio fails to load a designer to be used for the Windows app.

    In addition, I’m trying to develop this app and use the recently updated ML.Net that will take advantage of SQLite. 

    No designer showing/available. 


    Fritz Switzer

All replies

  • Hi fswitz,

    Thank you for posting here.

    Based on your issue, please try to download and install the latest .NET CORE 3.0: 

    https://dotnet.microsoft.com/download/dotnet-core/3.0

    Any feedback will be expected.

    Cheers,

    Dylan


    MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments
    or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Edited by

      Friday, September 27, 2019 2:43 AM

  • According to docs….NET Core 3.0 is downloaded with the Visual Studio Update  16.3.1


    Fritz Switzer

    • Edited by
      fswitz
      Friday, September 27, 2019 2:25 PM

  • Viorel, 

    Yes the designer works for a WPF .NET Core app, but does not open for a Winforms .NET Core app. 

    I want to use a Winforms because The ML.NET SDK with Model Builder is now available. 


    Fritz Switzer

  • Hi fswitz,

    Sorry for delay in reply.

    the WinForms designer for .NET Core projects is not yet available in .NET Core 3.0. Currently it is only previewable and available as
    VSIX extension in VS.

    Please refer more here: Announcing .NET Core 3.0

    Cheers,

    Dylan


    MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments
    or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Edited by
      Dylan Zhu-MSFTMicrosoft contingent staff
      Monday, September 30, 2019 9:48 AM

  • Installed VSIX, creating Winforms .Net Core and opening the designer with shift-F7 I get the following error message. 

    Could not load file or assembly ‘System.ComponentModel.Primitives, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.


    Fritz Switzer

  • Hi fswitz,

    Sorry for delay in reply.

    I have installed the extension in lastest version of VS2019 community and enterprise, the winform designer(.NET Core) both works normally. And this error is a known issue in previous version. 

    So I’m sorry that you need to reqpair or reinstall visual studio 2019 on your machine, and sorry for this inconvenience.

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any
    compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

Windows Forms — Visual Studio 2019 (16.5 Preview 1 — .NET CORE 3.1)

Starting from Visual Studio 16.5 Preview 1, there is builtin support for Windows Forms designer in Visual Studio. To use the designer:

  • You must be using Visual Studio 16.5 Preview 1 or a later version.
  • You need to enable the designer in Visual Studio. Go to Tools ? Options ? Environment ? Preview Features and select the Use the preview Windows Forms designer for .NET Core apps option.

For more information:

  • Updates to .NET Core Windows Forms designer in Visual Studio 16.5 Preview 1.
  • WinForms and WPF .NET CORE repositories.

Keep in mind, in this release, many controls aren’t yet supported in designer.

Workaround for Older versions

Starting from Visual Studio 16.5 Preview 1, there is builtin support for Windows Forms designer in Visual Studio. But for older versions you can use the following workaround:

At the moment, there is a workaround for using Classic .NET Windows Forms Designer for .NET CORE Windows Forms projects.

The workaround relies on having Classic WinForms App and CORE WinForms app in the same solution, having the same root namespace.

For adding new designable items, every time which you want to add new item, you need to add it to classic project, then move the 3 generated files (.cs, .designer.cs, .resx) to the CORE app, then adding them as link to the classic app.

For editing, since they are available as a link in classic app, edit them in the designer of classic app. All changes are visible to CORE app.

Prepare solution to use Windows Forms Designer for .NET Core Winforms App

  1. Create a Windows Forms .NET Core App. (See the steps and requirements.)
  2. Open the project in Visual Studio and save the the project including solution.
  3. Right click on Solution and Add New Project ? From templates, select Windows Forms project, and name it the same name as Core app + «.Designer» and click OK.
  4. In properties of the Classic framework project, set default namespace to same default namespace of Core app.
  5. Erase all exising files in both projects and save changes.

Adding a Form or UserControl

Every time which you want to add a new form or user control, you need to do the following steps:

  1. In the classic framework project, Add New Item
  2. Select Windows Form or User Control
  3. Do some changes in desginer, like resizing the form, so resx file will be generated and Save.
  4. In solution explorer, right click on the form and choose Cut.
  5. In core app, paste all the items.(form, designer, resx).
  6. In the classic app, right click and choose Add Existing Item.
  7. Browse open dialog to core app folder and choose those 3 added files and click dropdown near of add button and choose Add As Link
  8. Compile the solution.
  9. Renest the files in the classic app using Mad Kristensen’s File Nesting Extension or by editing project file.

Now, whenever you need to use the Designer on one of the Core Form or UserControl files, simply open the linked files in the Classic Framework project with the Classic Windows Forms Designer.

WPF — VS 2019 (16.0.3 .NET CORE 3.0)

The GA version of the WPF .NET Core Designer has been released at the same time as .NET Core 3.0 and it comes with Visual Studio.

Reference:

WPF Designer is completely independent of the Windows Forms Designer. We released its GA version of the WPF .NET Core Designer at the same time as .NET Core 3.0 and it comes with Visual Studio. In Visual Studio version 16.3.0 we had an issue with the Enable XAML Designer property set to false by default. That means that when you click on .xaml files, the designer doesn’t open automatically. Upgrade to the latest Visual Studio version 16.3.1 where this issue is fixed. Another option to fix it is to go to Tools -> Options -> XAML Designer and check Enable XAML Designer.

Понравилась статья? Поделить с друзьями:
  • Windows forms combobox значение по умолчанию
  • Windows forms checkedlistbox только один элемент
  • Windows forms c решение квадратного уравнения
  • Windows forms c возведение в степень
  • Windows forms c visual studio учебник