Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio and Self Containing Deployments

I'm trying to publish self containing deployment using Visual Studio. I can easily achieve that using CLI by running:

dotnet new mvc --auth None --framework netcoreapp1.1            
dotnet restore --runtime win81-x64      
dotnet build
dotnet publish -c release --runtime win81-x64    

This commands will create new mvc application, restore all libraries for win81-x64 runtime and will publish it. As a result deployment will contain runtime for .net core 1.1 / win81-x64 platform as part of the application. This way I can install it on the server where .net core 1.1 is not pre-installed.

My question is how can I achieve that using Visual Studio 2017 publish UI? If I do simple publish it will not include .net core runtime files.

Thanks!

like image 773
serhiyb Avatar asked Mar 10 '23 15:03

serhiyb


1 Answers

Unfortunately, this feature (picking a runtime during publish) didn't make it into the VS 2017 RTM release. We plan on adding it in a future release.

For now, to work around not having the feature, you can add the <RuntimeIdentifier> property to your .csproj.

<PropertyGroup>
  <TargetFramework>netcoreapp1.1</TargetFramework>
  <RuntimeIdentifier>win81-x64</RuntimeIdentifier>
</PropertyGroup>

Now when you publish it will publish standalone for that runtime.

You will need to remove this property when you want to publish your app without the .net core runtime files. And you can change the value if you want to publish for a different runtime.

like image 133
Eric Erhardt Avatar answered Mar 13 '23 02:03

Eric Erhardt