title: .NET Core - Self Contained Deployment not working
body: <p>I have a .NET Core Web Application. I'm using the <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish?tabs=netcore21" rel="noreferrer">publish</a> command to create a <a href="https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli" rel="noreferrer">self contained deployment</a>. </p>
  
  <p>It creates the files and appears to create .net core dlls, but when runnning in IIS on Windows 10, I still need to install the <a href="https://dotnet.microsoft.com/download" rel="noreferrer">.NET Core Runtime</a> to get it to work. After installing .NET Core Hosting bundle it works fine.</p>
  
  <p>I have reviewed a lot of other posts before asking, but can't find the answer.</p>
  
  <p>By default IIS gives the following error:</p>
  
  <blockquote>
    <p>HTTP ERROR 500.19 – Internal Server Error</p>
  </blockquote>
  
  <p>My Publish command:</p>
  
  <pre><code>dotnet publish "mydirectory\mywebsite.csproj" --self-contained --framework netcoreapp2.1 -r win10-x64 -c Release
  </code></pre>
  
  <p>The csproj looks like this:</p>
  
  <pre><code> &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
      &lt;UserSecretsId&gt;aspnet-mywebsite-656GASF8-B9H4-5963-1038-5D735B609E15&lt;/UserSecretsId&gt;
        &lt;RuntimeIdentifiers&gt;win10-x64&lt;/RuntimeIdentifiers&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>Here are the published files.</p>
  
  <p><a href="https://i.stack.imgur.com/CrOqh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CrOqh.png" alt="enter image description here"></a></p>
  
  <p>I thought maybe the 'l1-1-0' part might be the wrong framework version, but my dotnet version is 2.1.500.</p>
  
  <p><a href="https://i.stack.imgur.com/OKQfw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OKQfw.png" alt="enter image description here"></a></p>
  
  <p>What do I need to do to get it to work please?</p>