I've got Visual Studio 2017 15.8.7 installed on Windows 10 with .NET Core SDK v2.1.403. I'm trying to create a self contained deployment for a dotnet core console application. When Visual Studio publishes the application it is creating a publish directory and a win-x64 directory and I'm not sure which one is the correct directory to use for deploying my console application.
I'm following the dotnet core app deployment documentation. Here are the contents of my .pubxml file:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Debug</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp2.1</TargetFramework>
<PublishDir>bin\Debug\netcoreapp2.1\publish\</PublishDir>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<_IsPortable>false</_IsPortable>
</PropertyGroup>
</Project>
The documentation says that the output will be placed in the PublishDir
which I've set to be bin\Debug\netcoreapp2.1\publish\
. When I publish the application, I see two directories in bin\Debug\netcoreapp2.1
- a publish directory and a win-x64 directory. The win-x64 directory has far fewer items in it than the publish directory; just my project output, an .exe file for my application, and the following files: hostfxr.dll
, hostpolicy.dll
, and <myappname>.deps.json
. The publish directory has all of those files plus many more dlls; kind of what I was expecting for a self-contained deployment.
What is the difference between these two directories?
The documentation says:
Note that each target location (in the case of our example, bin\release\netcoreapp2.1\publish\ profile-name contains the complete set of files (both your app files and all .NET Core files) needed to launch your app.
I've got the publish directory set up as the target location so where is win-x64 coming from? Does it have the bare minimum files necessary to run the application or someting? When I try to run the .exe file in the win-x64 directory, the console application seems to run just fine. I'm trying to figure out whether I need to use the contents of the publish directory or the win-x64 directory. I've been searching through the docs site and other sites online but I can't find any clear explanation about why two output directories are being created. There's a notable size difference so if I can get away with using win-x64, that would be great. I'm just not sure if that's the correct directory to use.
dotnet MyApp.dll
to run. I can run theMyApp.exe
file directly. That's making me wonder if this is also an output directory. – greyseal96