.NET Core Version: (e.g. 3.0 Preview1, or daily build number, use dotnet --info)
3.0.100-preview-009750
Windows version: (winver)
Version 1809 (OS Build 17763.134)
Does the bug reproduce also in WPF for .NET Framework 4.8?: No
Problem description:
When trying to build a basic WPF project for dotnet core 3.0 I get multiple duplicate attribute errors that appear to be from a temporary file (\obj\Debug\netcoreapp3.0\NetCoreWpf_xnekjbde_wpftmp.AssemblyInfo.cs) conflicting with the actual AssemblyInfo.cs file
To get this error, after a fresh install of Visual Studio 2019 preview 1 I tried to open and build a wpf dotnet core project modified using Brian Lagunis's instructions from his blog post here. The project is empty (was generated in Visual Studio 15.9.3)
Actual behavior:
6 duplicate attribute errors fail the build.
CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
CS0579 Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute
Expected behavior:
No duplicate attribute errors occur unless there are duplicate attributes in my project, in which case the error message should point to the human-made code where the error occurs.
Minimal repro:
https://github.com/KelsonBall/WpfDotnetCoreDuplicateAttributeError
@stevenbrix - can you take a look at the repro?
@KelsonBall do you get the same errors if you create a new project using dotnet new wpf from the command line? For some reason your repro project is failing to load for me in VS2019 preview 1, without any helpful error infomration. I'm going to follow the instructions on the video and see if i can get into the same state.
@stevenbrix We need not add the AssemblyInfo.cs file when we use the new csproj file.
@KelsonBall i looked at your .csproj file a bit closer and noticed a few issues with it:
<UseWpf>true</UseWpf> from the PropertyGroup<Project Sdk="Microsoft.NET.Sdk.Wpf"> instead of <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">FrameworkReferenceto Microsoft.Desktop.UI is no longer needed as that package no longer exists.@KelsonBall Following onto what @stevenbrix said, this looks like you're following instructions that were useful before the Preview was released. At this point, you should base your project changes off of the basic templates provided by "dotnet new wpf".
Thanks everyone - using the dotnet new wpf command has been working for me.
Most helpful comment
@KelsonBall Following onto what @stevenbrix said, this looks like you're following instructions that were useful before the Preview was released. At this point, you should base your project changes off of the basic templates provided by "dotnet new wpf".