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.

Cannot restore packages for self-contained application on macOS Sierra 10.12-x64

See original GitHub issue

On macOS Sierra I cannot restore packages for a dotnet app that I build as a self-contained/standalone app.

Steps to reproduce

This is what my project.json file looks like in order to build it self-contained:

...
"Microsoft.NETCore.App": {
      "version": "1.0.1"
}
...
"runtimes": {
    "win10-x64": {},
    "win8-x64": {},
    "osx.10.10-x64": {},
    "osx.10.11-x64": {
      "#import": [ "osx.10.11", "osx.10.10-x64" ]
    },
    "osx.10.12-x64": {
      "#import": [ "osx.10.12", "osx.10.11-x64" ]
    },
    "debian.8-x64": {}
},

dotnet restore

Expected behavior

restore command to complete successfully

Actual behavior

The following errors occur during the restore

error: System.Threading.Timer 4.0.1 provides a compile-time reference assembly for System.Threading.Timer on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Diagnostics.Process 4.1.0 provides a compile-time reference assembly for System.Diagnostics.Process on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Globalization.Extensions 4.0.1 provides a compile-time reference assembly for System.Globalization.Extensions on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.IO.FileSystem.Watcher 4.0.0 provides a compile-time reference assembly for System.IO.FileSystem.Watcher on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.IO.MemoryMappedFiles 4.0.0 provides a compile-time reference assembly for System.IO.MemoryMappedFiles on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Net.NameResolution 4.0.0 provides a compile-time reference assembly for System.Net.NameResolution on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Net.Requests 4.0.11 provides a compile-time reference assembly for System.Net.Requests on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Net.Security 4.0.0 provides a compile-time reference assembly for System.Net.Security on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Security.Cryptography.Algorithms 4.2.0 provides a compile-time reference assembly for System.Security.Cryptography.Algorithms on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Security.Cryptography.Encoding 4.0.0 provides a compile-time reference assembly for System.Security.Cryptography.Encoding on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Security.Cryptography.X509Certificates 4.1.0 provides a compile-time reference assembly for System.Security.Cryptography.X509Certificates on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Collections 4.0.11 provides a compile-time reference assembly for System.Collections on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Runtime 4.1.0 provides a compile-time reference assembly for System.Runtime on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Runtime.Extensions 4.1.0 provides a compile-time reference assembly for System.Runtime.Extensions on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.IO 4.1.0 provides a compile-time reference assembly for System.IO on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Reflection.Extensions 4.0.1 provides a compile-time reference assembly for System.Reflection.Extensions on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Text.Encoding 4.0.11 provides a compile-time reference assembly for System.Text.Encoding on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Diagnostics.Debug 4.0.11 provides a compile-time reference assembly for System.Diagnostics.Debug on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Globalization 4.0.11 provides a compile-time reference assembly for System.Globalization on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Net.Primitives 4.0.11 provides a compile-time reference assembly for System.Net.Primitives on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Runtime.InteropServices 4.1.0 provides a compile-time reference assembly for System.Runtime.InteropServices on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Threading.Tasks 4.0.11 provides a compile-time reference assembly for System.Threading.Tasks on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Runtime.InteropServices.RuntimeInformation 4.0.0 provides a compile-time reference assembly for System.Runtime.InteropServices.RuntimeInformation on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Resources.ResourceManager 4.0.1 provides a compile-time reference assembly for System.Resources.ResourceManager on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.IO.FileSystem 4.0.1 provides a compile-time reference assembly for System.IO.FileSystem on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Console 4.0.0 provides a compile-time reference assembly for System.Console on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Reflection 4.1.0 provides a compile-time reference assembly for System.Reflection on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Diagnostics.Tracing 4.1.0 provides a compile-time reference assembly for System.Diagnostics.Tracing on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Reflection.Primitives 4.0.1 provides a compile-time reference assembly for System.Reflection.Primitives on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: Microsoft.Win32.Primitives 4.0.1 provides a compile-time reference assembly for Microsoft.Win32.Primitives on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Diagnostics.Tools 4.0.1 provides a compile-time reference assembly for System.Diagnostics.Tools on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Globalization.Calendars 4.0.1 provides a compile-time reference assembly for System.Globalization.Calendars on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.IO.Compression 4.1.0 provides a compile-time reference assembly for System.IO.Compression on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Net.Http 4.1.0 provides a compile-time reference assembly for System.Net.Http on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Net.Sockets 4.1.0 provides a compile-time reference assembly for System.Net.Sockets on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Runtime.Handles 4.0.1 provides a compile-time reference assembly for System.Runtime.Handles on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Text.Encoding.Extensions 4.0.11 provides a compile-time reference assembly for System.Text.Encoding.Extensions on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: Microsoft.Win32.Registry 4.0.0 provides a compile-time reference assembly for Microsoft.Win32.Registry on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: System.Security.Principal.Windows 4.0.0 provides a compile-time reference assembly for System.Security.Principal.Windows on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with osx.10.12-x64.
error: One or more packages are incompatible with .NETCoreApp,Version=v1.0 (osx.10.12-x64).

Environment data

dotnet --info output:

$ dotnet --info
.NET Command Line Tools (1.0.0-preview2-003131)

Product Information:
 Version:            1.0.0-preview2-003131
 Commit SHA-1 hash:  635cf40e58

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64

If I remove the 10.12-x64 runtime reference and add "type": "platform" to the app declaration I am able to restore and run. This was working as a self contained app on osx10.11.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:24 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
eerhardtcommented, Sep 28, 2016

A quick workaround to get folks unblocked:

You can set DOTNET_RUNTIME_ID=osx.10.11-x64 environment variable, and that will tell the CLI to use that RID. This will allow you to restore, build, run, publish as normal.

NOTE: a real fix is in the works. This is just a workaround until the fix is available.

2reactions
eerhardtcommented, Jan 9, 2017

It does have a RID for osx.10.12, but only if you are targeting netcoreapp1.1 and Microsoft.NETCore.App 1.1.0.

https://github.com/dotnet/corefx/blob/73bf061349650cecd6df04fecce7f073b9cf584d/pkg/Microsoft.NETCore.Platforms/runtime.json#L175-L180

netcoreapp1.0 shipped before OSX 10.12, so that wasn’t a fully-supported OS version for netcoreapp1.0.

@nathanielcook - can you try targeting netcoreapp1.1 and see if you continue having problems?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot restore packages for self-contained application on ...
On macOS Sierra I cannot restore packages for a dotnet app that I build as a self-contained/standalone app.
Read more >
NET Core Standalone build will not run on MacOS 10.12
It seems to be an environment problem, creating a new project, using the docker, and copying your project.json work as well.
Read more >
NET Runtime Identifier (RID) catalog
10.12-x64 in the package. If NuGet can't find the specific runtime, it can restore packages that specify osx.10.11-x64 runtimes, for example.
Read more >
How to build cross-platform console apps with .NET Core
To prove this works, try running dotnet restore, which will restore any packages needed to run your app. After that finishes, run dotnet...
Read more >
Fundamentals of .NET Application Structure | Defining ASP ...
The restore command acquires any runtime libraries needed to build for the extra runtimes listed in the project file. The publish command first ......
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