-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Closed
Copy link
Labels
Needs: Attention πThis issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Description
When working with .NET 9.0 Blazor WebAssembly projects in Visual Studio Code (both regular and Insiders versions), duplicate 'TargetFrameworkAttribute' errors are appearing during build, despite having a correct project configuration.
Environment
- .NET Version: 9.0.5
- Project Type: Blazor WebAssembly
- IDE: Visual Studio Code with C# Dev Kit
- Operating System: Windows
- Project SDK: Microsoft.NET.Sdk.BlazorWebAssembly
Project Configuration
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>BlazorApp.Client</RootNamespace>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.5" PrivateAssets="all" />
</ItemGroup>
</Project>
Expected Behavior
The project should build without duplicate attribute errors, as the project file configuration is correct and follows the standard template structure.
Steps To Reproduce
Steps to Reproduce
- Create a new Blazor WebAssembly project targeting .NET 9.0
- Open the project in VS Code
- Build the project
- Observe build errors in the Problems panel
Exceptions (if any)
No response
.NET Version
9.0.204
Anything else?
Additional Information
- The issue persists even after:
- Cleaning and rebuilding the solution
- Deleting bin/obj folders
- Restoring NuGet packages
- Using different versions of VS Code
- This appears to be specific to .NET 9.0 Blazor projects when using VS Code
- The same project builds correctly in Visual Studio 2022
Workarounds Attempted
- Manually deleting the generated AssemblyAttributes.cs file (regenerates with same issue)
- Adding
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
(impacts other necessary assembly attributes) - Various combinations of project file settings related to assembly info generation
Terminal Last Command:
dotnet build
PS C:\Users\MPhil\source\repos\Words\cautious-robot\Client> dotnet build
Restore complete (0.5s)
Shared succeeded (0.3s) β C:\Users\MPhil\source\repos\Words\cautious-robot\Shared\bin\Debug\netstandard2.0\Shared.dll
CodeleLogic succeeded (0.5s) β C:\Users\MPhil\source\repos\Words\cautious-robot\CodeleLogic\bin\Debug\net8.0\CodeleLogic.dll
Client failed with 8 error(s) (0.4s)
C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\.NETCoreApp,Version=v9.0.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime
.Versioning.TargetFrameworkAttribute' attribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(13,12): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' a
ttribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(14,12): error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttrib
ute' attribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(15,12): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribut
e' attribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(16,12): error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersio
nAttribute' attribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(17,12): error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' a
ttribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(18,12): error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' att
ribute C:\Users\MPhil\source\repos\Words\cautious-robot\Client\obj\Debug\net9.0\Client.AssemblyInfo.cs(19,12): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' a
ttribute
Build failed with 8 error(s) in 1.6s
Metadata
Metadata
Assignees
Labels
Needs: Attention πThis issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components