If you are still using the .NET Core preview tooling in Visual Studio 2015, you likely have run into the issue where you attempt to reference a .NET Framework project in a .NET Core project and have seen the error “Unable to find version ‘x’ or package ‘y’” sporadically. To work around the issue, the best fix is to create a NuGet package and local package source to store the package for the .NET Framework assembly. Then you can reference the package in the .NET Core project rather than the project itself.

Creating a NuGet Package

Creating a NuGet package is well documented and pretty straight forward. First, you need to create a nuspec file. Here’s an example.

Next, you’ll want to package up any DLLs or content and use the NuGet pack command to create a nupkg. Then you’ll want to create a local package store and add your package to it. Here’s a script you can run during post-build.

The last step is to reference that NuGet package in the project.json of your .NET Core project. It will locate the local store and import the package.

Not the perfect solution

This still isn’t the perfect solution. You need to ensure that your NuGet package project is built before your .NET Core project. This means updating your build steps in your solution or creating a build script. You’ll also need to make sure to bump the version of your NuGet package when making changes.

This is really just a bandaid until you can move to the 1.0 .NET Core tooling and Visual Studio 2017.