question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SDK upgrade causes compile failure due to not generating VB.NET WPF code behind

See original GitHub issue

Repro:

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:closed
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dsplaistedcommented, Aug 5, 2020

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 with dotnet.

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 the TargetFrameworkIdentifier is .NETFramework, and UseWPF 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).

0reactions
joeloffcommented, Sep 16, 2020

This should be in RC1

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found