title: .net 6 minimal api docker issue: error CS5001: Program does not contain a static 'Main' method suitable for an entry point
body: <p>I have seen a number of similar questions but none seem to represent exactly the issue I am facing. When I create a folder structure as follows:</p>
  <pre><code>./
  ./src
  ./src/test
  </code></pre>
  <p>Then navigate to <code>./src/test</code> and run <code>dotnet new webapi -lang c#</code>, this will create a minimal API which works fine. I can also run <code>dotnet publish -c RELEASE -o out /p:Version=1.0.0</code> without any issues.</p>
  <p>When I then try create a docker file at the root level with the following contents:</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  
  ARG BUILDCONFIG=RELEASE
  ARG VERSION=1.0.0
  
  COPY ./src/test/test.csproj ./src/test/
  RUN dotnet restore ./src/test/test.csproj
  
  COPY ./src/ ./
  WORKDIR ./src/test/
  RUN dotnet publish -c $BUILDCONFIG -o out /p:Version=$VERSION
  
  FROM mcr.microsoft.com/dotnet/sdk:6.0
  WORKDIR /app
  COPY --from=build /src/test/out ./
  
  EXPOSE 5000
  ENTRYPOINT [&quot;dotnet&quot;, &quot;test.dll&quot;]
  </code></pre>
  <p>I get the following output:</p>
  <pre><code> =&gt; ERROR [build 6/6] RUN dotnet publish -c RELEASE -o out /p:Version=1.0.0                                        2.5s
  ------
   &gt; [build 6/6] RUN dotnet publish -c RELEASE -o out /p:Version=1.0.0:
  #11 0.511 Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET
  #11 0.511 Copyright (C) Microsoft Corporation. All rights reserved.
  #11 0.511
  #11 0.931   Determining projects to restore...
  #11 1.153   All projects are up-to-date for restore.
  #11 2.400 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/test/test.csproj]
  </code></pre>
  <p>I tried a few things, including setting the <code>OutputType</code> in the csproj to <code>Exe</code>, <code>DockerDefaultTargetOS</code> to both win/linux and a few other suggestions I found in other threads but ultimately I always get the same error. Any ideas whay might be wrong?</p>