-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
- .NET Core Version: .net6.0-windows
- .NET Core SDK Version: 6.0.100
- Windows Version: 10.0.19043.1288
- Visual Studio Version: 17.1.0 Preview 1.0
- Does the bug reproduce also in WPF for .NET Framework 4.8?: Not tested
- Is this bug related specifically to tooling in Visual Studio? In the XAML editor and during build
Problem description:
When I change the AssemblyName based on the MSBuildProjectName property, controls in the same project are no longer found. This error occurs both in the XAML editor and when building. When I change the sdk-Version (in csproj and global.json) to 5.0.400, everything works fine.
F12 (Go to definition) from XAML editor works as expected.
Actual behavior:
Build will fail with error code "MC3074"
Description: The tag 'UserControl1' does not exist in XML namespace 'clr-namespace:WpfApp1'. Line 10 Position 10.
Minimal repro:
- Create a new WPF project template "WPF Application"
- Select .NET 6.0 as target framework
- Create a new UserControl and use it in the MainWindow
- Run the project
=> This should build and start as expected - Add the following line to a PropertyGroup in the csproj-file:
<AssemblyName>test.$(MsBuildProjectName)</AssemblyName> - Run the project
=> Build will fail with error code "MC3074"
=> XAML-Editor should show the same error inline - Change the target framework to "net5.0-windows".
- Create global.json next to the sln file with the following content:
{ "sdk": { "version": "5.0.400" } } - Run the project
=> This should build and start as expected
This error only occurs when MSBuild properties are used. I tested it with
But if I use $(Nullable) for example, it works as expected.
If I use a fixed value (e.g. "test.project"), it also works as expected.