-
Notifications
You must be signed in to change notification settings - Fork 169
Program does not contain a static 'Main' method suitable for an entry point #401
Comments
This error isn't specific to Docker. It's a C# compiler error. For any project that is |
Here is the output from centos without docker using the same code:
So I think maybe something wrong in build image. I did a lot of searching before I post this issue. I'm sure code can work both in iisexpress and kestrel. |
If you can provide exact steps to reproduce the issue, we may be able to investigate more. The error message indicates that you are missing some of your source code when building inside the container. Double check your |
...and of course, I see you edited the original issue. So far you've only copied your .csproj files into the container. You need the .cs files too. Add this line to your dockerfile before COPY . . |
Thanks. |
what is the exact meaning of |
Syntax for this directive is |
Hi, i had the exact same error message and for me the issue was that i had my Docker file at the same level as my .csproj. When i moved csproj one level deeper, docker build run successfully. |
Got the same issue and what Rickinio said was right. Once I moved the Docker file one level up, things look better. But why was the file at the same level from the first place. I just created a fresh app. I guess they had to put at the same level so that Dockerfile is included in the solution explorer for those who use Visual Studio. VS seems smart enough to find things and start docker but |
Moving the Dockerfile up a level from the csproj corrected the issue of the Docker build failing due to not finding a Main entry aspnet/aspnet-docker#401 (comment)
Thanks. It worked. |
I ran into the same thing. There seems to be a VS bug here causing it to create the Dockerfile in the wrong place. |
I randomly got this issue when I was (accidentally) building to a parent directory. Like so: WORKDIR /app/src/
RUN dotnet build Thing.csproj -c Release -o /app Fixed it by chainging |
Hi,
Environment :
Centos 7.3
Docker version 17.09.0-ce, build afdb6d4
microsoft/aspnetcore-build docker image, pulled just now using docker pull microsoft/aspnetcore-build
I have two projects in solution.
demo.csproj default asp.net mvc project set up by vs 2017 community
Library.csproj default library project set up by vs 2017 community
Demo project reference the Library project.
Here is my dockerfile:
Here is my docker command:
docker build /site/test -t aspnetapp
Here is the output:
The text was updated successfully, but these errors were encountered: