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.

Targeting net5 using net6 SDK causes pack failure

See original GitHub issue

To 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

0reactions
robertmclawscommented, Oct 12, 2021

No worries, RC2 just officially came out, so we’re upgrading now. Thanks!

Read more comments on GitHub >

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

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