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.

Build error throws when running dotnet pack with multiple target framework

See original GitHub issue

Bug Description:

After upgrading the .NET 6.0 preview 1 SDK, it throws build error when running dotnet pack command line. The problem is occur when the project file have multiple target frameworks <TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>. If I change it to single <TargetFramewok> then it works fine.

Exceptions (if any)

C:\Program Files\dotnet\sdk\6.0.100-preview.1.21103.13\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.ScopedCss.targets(134,3): error MSB4044: The “ComputeCssScope” task was not given a value for the required parameter “TargetName”. [D:\Feb\NET6\RazorClassLibrary2\RazorClassLibrary2.csproj]

To Reproduce

  • Download the Razor sample.
  • Goto command prompt and then run the command dotnet pack -c Release

Sample:

RazorClassLibrary3.zip

Further technical details

Blazor RazorClass Library 6.0 sample Latest SDK .NET 6.0 Preview 1 VS 2019 preview

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
captainsafiacommented, Apr 13, 2021

@skclusive None yet. We’re tracking it under next sprint planning. If you’re affected by this, you can let us know by giving the issue a thumbs up.

3reactions
robertmclawscommented, Sep 3, 2021

Still running into this issue with Preview 7.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet pack targeting multiple frameworks
1 Answer 1 ... For multi-targeting, use the plural TargetFrameworks property to provide a list of frameworks. TargetFramework (singular) only ...
Read more >
Troubleshoot .NET Framework targeting errors
A description of common NuGet restore errors in Visual Studio and how to troubleshoot them.
Read more >
Multi-targeting for NuGet Packages
If the project targets .NET framework 4.0 and earlier, NuGet throws an appropriate error message for not finding the compatible assembly.
Read more >
Chapter 11. Multiple frameworks and runtimes - .NET Core in ...
NET Core SDK makes it possible to support multiple frameworks in the same NuGet package (generated by dotnet pack ). Frameworks vs. runtimes....
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
You can go through these steps in a simplistic, “try to build;fix the next error; repeat” way. 1. Change TargetFramework to TargetFrameworks.
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