.NET Core 1.0 app won't run on .NET Core 1.1 system
I have a program that I'm trying to migrate over to .NET Standard/Core. The command line interface to the library is built with a target framework of netcoreapp1.0. I tried sending this to a tester (with a different OS) who only had .NET Core 1.1 installed. The program won't run, and gives the error:
The specified framework 'Microsoft.NETCore.App', version '1.0.1' was not found.
- Check application dependencies and target a framework version installed at:
/usr/share/dotnet/shared/Microsoft.NETCore.App
- The following versions are installed:
1.1.0
- Alternatively, install the framework version '1.0.1'.
Is this expected? As I understood it, each Core/Standard version was a strict superset of the prior one. As such, I expected a program that targeted 1.0 would still run on a system with 1.1, rather than having to multi-target every installation version.
More generally, how can I set things up so that I don't have to worry about a user coming along later with only a newer version of .NET Core being unable to run the program?
You need to understand a few more concepts.
A .NET Core app becomes self-contained if you use dotnet publish
properly. Then on a target machine that has no .NET Core installed (or not the version it builds against) the app can run without problems. Based on your description, you probably forget to do so or you are not trying to publish this app.
If your intention is just to move your .NET Core 1.0.1 based code to another machine and that machine only has 1.1.0 installed, well, you should be able to run dotnet-install
script to install the required runtime,
https://docs.microsoft.com/en-us/dotnet/articles/core/preview3/tools/dotnet-install-script
Since you are using Visual Studio 2017 RC already, you should know that .NET Core 1.0.x now should be 1.0.3. Support for 1.0.0-1.0.2 have expired.
You're missing a global.json. Add one to your project so the application knows to boot with the 1.0.0 runtime and not 1.1.
链接地址: http://www.djcxy.com/p/94704.html