title: dotnet publish profile CLI vs Visual Studio behave different
body: <p>I have a dotnet core 2.1 web API project with a publish profile to a folder that lately I plan to copy to an IIS as in <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore21" rel="nofollow noreferrer">dotnet publish documentation</a>.</p>
  
  <p>I created the publish profile with VS and the resulting file is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--
  This file is used by the publish/package process of your Web project. You can customize the behavior of this process
  by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
  --&gt;
  &lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;PropertyGroup&gt;
      &lt;WebPublishMethod&gt;FileSystem&lt;/WebPublishMethod&gt;
      &lt;PublishProvider&gt;FileSystem&lt;/PublishProvider&gt;
      &lt;LastUsedBuildConfiguration&gt;Release&lt;/LastUsedBuildConfiguration&gt;
      &lt;LastUsedPlatform&gt;Any CPU&lt;/LastUsedPlatform&gt;
      &lt;SiteUrlToLaunchAfterPublish /&gt;
      &lt;LaunchSiteAfterPublish&gt;True&lt;/LaunchSiteAfterPublish&gt;
      &lt;ExcludeApp_Data&gt;False&lt;/ExcludeApp_Data&gt;
      &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
      &lt;RuntimeIdentifier&gt;win-x64&lt;/RuntimeIdentifier&gt;
      &lt;ProjectGuid&gt;b3155c62-817f-4eba-8856-e5941137f4ed&lt;/ProjectGuid&gt;
      &lt;SelfContained&gt;true&lt;/SelfContained&gt;
      &lt;_IsPortable&gt;false&lt;/_IsPortable&gt;
      &lt;publishUrl&gt;bin\publish\&lt;/publishUrl&gt;
      &lt;DeleteExistingFiles&gt;True&lt;/DeleteExistingFiles&gt;
    &lt;/PropertyGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>If I run the profile from VS it creates a <code>bin\publish</code> folder that I can copy to IIS.</p>
  
  <p>If I do the same with <code>dotnet publish /p:PublishProfile=FolderProfile</code> (as in the CI server) after updating to latest VS I get the following error</p>
  
  <p><code>C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(122,5): error NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true. [C:\Users\Guillem.Sola\source\repos\ASG.DHW.HealthCheck\ASG.DHW.HealthCheck.API\ASG.DHW.HealthCheck.API.csproj]</code></p>
  
  <p>I can achieve something similar excuting in cmd</p>
  
  <p><code>dotnet publish .\HealthCheck.API\HealthCheck.API.csproj -o .\bin\publish -r win-x64 -c Release</code></p>
  
  <p>What is going on, why the profile is not behaving the same when calling from CLI?</p>