locked
.NET application failing with unknown error RRS feed

  • Question

  • User1980547736 posted

    Hello Community,

    Can someone please let m know why I'm getting the following error from my visual studio code:

    CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\app\mycsharpmodule4.csproj]
    The command 'cmd /S /C dotnet publish -c Release -o out' returned a non-zero code: 1

    The follow output is as follows:

    The push refers to repository [carlscontainer.azurecr.io/mycsharpmodule4]
    An image does not exist locally with the tag: carlscontainer.azurecr.io/mycsharpmodule4
    PS C:\Users\Carlton\Documents\MyFirstModule4\EdgeSolution2> docker build --rm -f "c:\Users\Carlton\Documents\MyFirstModule4\EdgeSolution2\modules\mycsharpmodule4\Dockerfile.amd64" -t carlscontainer.azurecr.io/mycsharpmodule4:0.0.1-amd64 "c:\Users\Carlton\Documents\MyFirstModule4\EdgeSolution2\modules\mycsharpmodule4" ; if ($?) { docker push carlscontainer.azurecr.io/mycsharpmodule4:0.0.1-amd64 }
    Sending build context to Docker daemon 539.1kB
    Step 1/12 : FROM microsoft/dotnet:2.0-sdk AS build-env
    ---> 171dea684b3c
    Step 2/12 : WORKDIR /app
    ---> Using cache
    ---> f7a8eb2c5fbc
    Step 3/12 : COPY *.csproj ./
    ---> Using cache
    ---> 03c27bb0287d
    Step 4/12 : RUN dotnet restore
    ---> Using cache
    ---> 74add4c9df90
    Step 5/12 : COPY . ./
    ---> Using cache
    ---> f060c00a955b
    Step 6/12 : RUN dotnet publish -c Release -o out
    ---> Running in 251fdac1a08c
    Microsoft (R) Build Engine version 15.7.177.53362 for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.

    Restoring packages for C:\app\mycsharpmodule4.csproj...
    Generating MSBuild file C:\app\obj\mycsharpmodule4.csproj.nuget.g.props.
    Restore completed in 3.58 sec for C:\app\mycsharpmodule4.csproj.
    CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\app\mycsharpmodule4.csproj]
    The command 'cmd /S /C dotnet publish -c Release -o out' returned a non-zero code: 1
    PS C:\Users\Carlton\Documents\MyFirstModule4\EdgeSolution2>

    Any thoughts will be greatly appreciated.

    Carlton

    Tuesday, July 10, 2018 9:03 PM

All replies

  • User1120430333 posted

    CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [C:\app\mycsharpmodule4.csproj]
    The command 'cmd /S /C dotnet publish -c Release -o out' returned a non-zero code: 1

    Where is Program.cs with the Main()? What kind of application is this?

    Tuesday, July 10, 2018 11:03 PM
  • User1980547736 posted

    I'm afraid I have totally messed up. I thought I could use part of a script to build a new script. I now understand it doesn't work that way.

    I will go ahead and close this issue.

    Thanks for responding anyway

    Tuesday, July 10, 2018 11:13 PM