title: Unable to build dotnet project in docker
body: <p>I'm new to docker and i was trying to migrate my API written in .NET 6 from IIS to a Docker.</p>
  <p>So i've wrote a Docker file</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
  WORKDIR /app
  
  FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  WORKDIR /src
  
  # copy all the layers' csproj files into respective folders
  COPY ./VisualOrder.csproj src/
  
  # run restore over API project - this pulls restore over the dependent projects as well
  RUN dotnet restore &quot;src/VisualOrder.csproj&quot;
  
  COPY . .
  
  # run build over the API project
  WORKDIR &quot;/src/&quot;
  RUN dotnet build -c Release -o /app/build
  
  # run publish over the API project
  FROM build AS publish
  RUN dotnet publish -c Release -o /app/publish
  
  FROM base AS runtime
  WORKDIR /app
  
  COPY --from=publish /app/publish .
  RUN ls -l
  ENTRYPOINT [ &quot;dotnet&quot;, &quot;VisualOrder.dll&quot; ]
  </code></pre>
  <p>But the issue is that at <code>RUN dotnet build ...</code> the build fails with the following error:</p>
  <blockquote>
  <p>Restored /src/VisualOrder.csproj (in 338 ms).
  #15 1.897 /usr/share/dotnet/sdk/6.0.101/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(356,5):
  error NETSDK1073: The FrameworkReference
  'Microsoft.WindowsDesktop.App' was not recognized
  [/src/VisualOrder.csproj]</p>
  </blockquote>
  <p>I tried to run dotnet restore on my PC by deleting bin and obj folders but on my PC all works as it have to.</p>
  <p>.csproj</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;net6.0-windows&lt;/TargetFramework&gt;
      &lt;SignAssembly&gt;false&lt;/SignAssembly&gt;
      &lt;UserSecretsId&gt;d96c762d-ae98-4b1d-a27d-af48bb400d26&lt;/UserSecretsId&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;Content Remove=&quot;bundleconfig.json&quot; /&gt;
      &lt;Content Remove=&quot;Views\Emails\EmailNegozio.cshtml&quot; /&gt;
      &lt;Content Remove=&quot;Views\Emails\EmailRiepilogo.cshtml&quot; /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;_ContentIncludedByDefault Remove=&quot;bundleconfig.json&quot; /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;EmbeddedResource Include=&quot;Views\Emails\EmailNegozio.cshtml&quot;&gt;
        &lt;CopyToOutputDirectory&gt;Always&lt;/CopyToOutputDirectory&gt;
      &lt;/EmbeddedResource&gt;
      &lt;EmbeddedResource Include=&quot;Views\Emails\EmailRiepilogo.cshtml&quot;&gt;
        &lt;CopyToOutputDirectory&gt;Always&lt;/CopyToOutputDirectory&gt;
      &lt;/EmbeddedResource&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;None Include=&quot;bundleconfig.json&quot; /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Microsoft.VisualStudio.Azure.Containers.Tools.Targets&quot; Version=&quot;1.14.0&quot; /&gt;
      &lt;PackageReference Include=&quot;MySql.Data&quot; Version=&quot;8.0.27&quot; /&gt;
      &lt;PackageReference Include=&quot;Newtonsoft.Json&quot; Version=&quot;13.0.1&quot; /&gt;
      &lt;PackageReference Include=&quot;PayPalCheckoutSdk&quot; Version=&quot;1.0.4&quot; /&gt;
      &lt;PackageReference Include=&quot;PayPalHttp&quot; Version=&quot;1.0.1&quot; /&gt;
      &lt;PackageReference Include=&quot;QRCoder&quot; Version=&quot;1.4.2&quot; /&gt;
      &lt;PackageReference Include=&quot;RazorEngine.NetCore&quot; Version=&quot;3.1.0&quot; /&gt;
      &lt;PackageReference Include=&quot;RestSharp&quot; Version=&quot;106.13.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Stripe.net&quot; Version=&quot;39.80.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore&quot; Version=&quot;6.2.3&quot; /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>