I want to publish a dotnet core project with a speicific minor version (3.1.1). The project needs to run on a machine which has that version installed, which I cannot upgrade. Currently my VS only publishes dlls with target version 3.1.5, and I cannot seem to be able to change that. I tried downgrading my installed dotnet core sdk version but that didn't work either.
0
votes
2 Answers
0
votes
You can try to publish your project framework independent.
Just edit your publish-options. (change framework-dependent to self-contained)
You can also use this code:
dotnet publish -c Release -r win10-x64 /p:PublishSingleFile=true
references:
https://gunnarpeipman.com/dotnet-core-self-contained-executable/
https://docs.microsoft.com/en-us/dotnet/core/deploying/#publish-self-contained
0
votes
You can refer to the following steps to publish .net core 3.1.1 version project.
First, please use the following command to check if your computer exists .net core sdks version 3.1.101:(If not exist, please install it)
dotnet --info
Second, you can create a global.json in the current directory setting the SDK version to 3.1.101:
dotnet new globaljson --sdk-version 3.1.101
Finally, you can publish your project:
dotnet publish
dotnet --version- canton7