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.

"dotnet build" fails on non-Windows for projects that multi-target where Desktop is one of the targets frameworks.

See original GitHub issue


If you have a project that multi-targets where one of Desktop is one of the target frameworks (such as <TargetFrameworks>net46;netcoreapp1.0</TargetFrameworks>), then the project will fail to build on non-windows with an error similar to:

Microsoft.Common.CurrentVersion.targets(1110,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

Expected Result

The Desktop framework should be ignored and a warning should be printed indicated the framework in question could not be built.

This is a reasonable solution since the Desktop framework is not to be available on non-Windows.

Additional Details

This also impacts solutions where some projects target Desktop and some target .NETStandard or .NETCore and projects that only target Desktop.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:30
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

tannergoodingcommented, Feb 7, 2017

@piotrpMSFT, that works for singular projects. That does not work when targeting an entire solution (which is perhaps a separate issue) where not every project targets the desired framework.

The command will fail with project.assets.json' doesn't have a target for '.NETStandard,Version=v1.6'. Ensure you have restored this project for TargetFramework='netstandard1.6' and RuntimeIdentifier=''. (or equivalent for whatever framework you built for).

The workaround would be to build all netstandard projects first, then to build all netcore or net projects, but that quickly becomes untenable.

bruno-garciacommented, Jul 24, 2019

ReferenceAssemblies are available on now. You can add it like this:

<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" />

With that you don’t need to hack paths for the Mono ReferenceAssemblies:

Read more comments on GitHub >

github_iconTop Results From Across the Web

NETSDK1138: The target framework is out of support
In this article ... NETSDK1138 indicates that your project targets a version of the framework that is out of support. The full error...
Read more >
Assets file obj\project.assets.json doesn't have a target
NET Standard and .NET Core when you're doing multi-targeting. You can't have a library target .NET Standard and then use dotnet build -f ......
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 projects...
Read more >
NETSDK1100: Set the `EnableWindowsTargeting` property ...
To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. To resolve this error, set the ...
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
(Optional) Support building the netframework target on mono for linux or macos. In my case working on a Mac, my next error is....
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 Post

No results found

github_iconTop Related Hashnode Post

No results found