Targeting net5 using net6 SDK causes pack failure
See original GitHub issueTo reproduce, create the empty files Component.razor
and Component.razor.css
(no content required).
As the csproj file use
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.9" />
</ItemGroup>
</Project>
Then run dotnet build
and afterwards dotnet pack
. The latter will fail with the error message
C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.StaticWebAssets.5_0.targets(436,5):
error : Static web asset 'C:\project\obj\Debug\net5.0\scopedcss\projectbundle\RazorClassLibrary1.bundle.scp.css' has invalid source type ''. [C:\project\project.csproj]
This is using SDK 6.0.100-preview.7.21379.14.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >The current .NET SDK does not support targeting .NET 6.0. ...
I experienced this issue while upgrading a project from .NET 5 to .NET 6, using Visual Studio 2022. In my case, the problem...
Read more >Troubleshoot .NET Framework targeting errors
To resolve the error, make sure that your application targets a .NET version that's compatible with the version that's targeted by the ...
Read more >Cannot load or run lots of my projects in my solution after ...
MSBuildWorkloadSdkResolver " failed while attempting to resolve the SDK "Microsoft.NET .Sdk". Exception: "Microsoft.NET.Sdk.
Read more >Azure Devops Build failing for .Net 5 when using multiple ...
Possible cause of the issue: It can compile fine in local machine cause you've installed . Net core 5.0 SDK in your local...
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
Seems to work with rc1: https://github.com/stefanloerwald/dotnet-sdk-issue-19665/actions/runs/1189053349
No worries, RC2 just officially came out, so we’re upgrading now. Thanks!