SDK upgrade causes compile failure due to not generating VB.NET WPF code behind
See original GitHub issueRepro:
Clone git@github.com:dotnet/project-system.git.
- Build with SDK 3.1.400-preview-015178 ✔️
- Build with SDK 5.0.100-preview.6.20318.15 ❌
Error:
src\Microsoft.VisualStudio.Editors\OptionPages\GeneralOptionPageControl.xaml.vb(45,13): error BC30451: ‘InitializeComponent’ is not declared. It may be inaccessible due to its protection level.
The project file defines the item as Page
but the Properties pane shows it as None
.
Potentially bad globs?
Note that this is a VB.NET file.
Also note that this worked with an earlier version of 5.0.100-preview*, but I don’t know which as it was uninstalled when I installed preview 6. I think it was preview 4.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
How to find the reason for a failed Build without any error or ...
I noticed that if "Build + Intellisense" is selected in the Error List, it causes the error messages to be swallowed.
Read more >Troubleshoot .NET Framework targeting errors
In this article This topic describes MSBuild errors that might occur because of reference issues and how you can resolve those errors.
Read more >NET project SDK overview
Each project SDK is a set of MSBuild targets and associated tasks that are responsible for compiling, packing, and publishing code.
Read more >Solution does not build with VS 2019 Community 16.8.2
After updating from 16.7.4 to 16.8.2 our solution does not build anymore. It is a WPF application. We have an error CS0246 (name...
Read more >"You must install .NET Desktop Runtime 6.0.4 (x64)" error
Recreating the issue. Using Visual Studio, create a new WPF Application targeting .NET 6.0. Build the application. Copy EXE and DLL from bin ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As I understand it, we broke SDK-style WPF projects which targeted .NET Framework, without setting
UseWPF
to true or using the WindowsDesktop SDK. Such projects were likely created before there was any WPF support for .NET Core. They would build with the .NET Framework version of MSBuild due to the implicit winfx.targets import, but would have failed to build withdotnet
.We should avoid breaking such projects, but we should also avoid importing multiple copies of the WPF targets. So I think the default value for
ImportWinFXTargets
in the SDK should be true ONLY when theTargetFrameworkIdentifier
is.NETFramework
, andUseWPF
is not set to true. That will avoid importing the legacy winfx targets for .NET Core projects, where they won’t work, and for .NET Framework projects which are importing the newer WPF targets (which should still work when targeting .NET Framework).This should be in RC1