title: Docker .Net 6 error Program does not contain a static 'Main' method suitable for an entry point
body: <p>I'm trying to build my docker image but i'm getting this error.</p>
  <p>error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/6GAG.WebApi/6GAG.WebApi.csproj]</p>
  <p>I have 3 projects in 1 solution.</p>
  <ul>
  <li>1 webapi</li>
  <li>1 frontend application</li>
  <li>1 class library</li>
  </ul>
  <p>My Dockerfile exist in the directory where my .sln file is</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/sdk:6.0 as build-env
  WORKDIR /app
  
  COPY 6GAG.WebApi/6GAG.WebApi.csproj /6GAG.WebApi/6GAG.WebApi.csproj 
  COPY 6GAG.Core/6GAG.Core.csproj /6GAG.Core/6GAG.Core.csproj
  RUN dotnet restore /6GAG.WebApi/6GAG.WebApi.csproj
  
  COPY ./ ./
  RUN dotnet publish /6GAG.WebApi/6GAG.WebApi.csproj -c Release -o out
  
  FROM mcr.microsoft.com/dotnet/aspnet:6.0
  WORKDIR /app
  EXPOSE 80
  COPY --from=build-env app/out/ .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;6GAG.WebApi.dll&quot;]
  </code></pre>
  <p>My .csproj file:</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;net6.0&lt;/TargetFramework&gt;
      &lt;RootNamespace&gt;_6GAG.WebApi&lt;/RootNamespace&gt;
      &lt;UserSecretsId&gt;7f7e2bd0-6f27-4752-afe8-9839b765d3f0&lt;/UserSecretsId&gt;
      &lt;DockerDefaultTargetOS&gt;Linux&lt;/DockerDefaultTargetOS&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;AutoMapper&quot; Version=&quot;10.1.1&quot; /&gt;
      &lt;PackageReference Include=&quot;FluentValidation.AspNetCore&quot; Version=&quot;10.3.4&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Authentication.JwtBearer&quot; Version=&quot;6.0.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Identity.EntityFrameworkCore&quot; Version=&quot;6.0.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore&quot; Version=&quot;6.0.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.SqlServer&quot; Version=&quot;6.0.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Tools&quot; Version=&quot;6.0.0&quot;&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Microsoft.Extensions.Logging.Debug&quot; Version=&quot;6.0.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.VisualStudio.Azure.Containers.Tools.Targets&quot; Version=&quot;1.11.1&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.VisualStudio.Web.CodeGeneration.Design&quot; Version=&quot;6.0.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore&quot; Version=&quot;6.2.3&quot; /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;ProjectReference Include=&quot;..\6GAG.Core\6GAG.Core.csproj&quot; /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;Folder Include=&quot;Migrations\&quot; /&gt;
    &lt;/ItemGroup&gt;
  
  
  &lt;/Project&gt;
  </code></pre>
  <p>how can i fix this issue?</p>