Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program does not contain a static 'Main' method suitable for an entry point #2214

Closed
Grauenwolf opened this issue Oct 5, 2019 · 11 comments
Closed

Comments

@Grauenwolf
Copy link

Grauenwolf commented Oct 5, 2019

Description

When I upgrade to Microsoft.NET.Test.Sdk v16.3.0 and rebuild, I get the below error message:

Program does not contain a static 'Main' method suitable for an entry point

Switching back to Microsoft.NET.Test.Sdk v16.2.0 clears the error.

This has been consistent for both .NET Core 2.1 and 3.0 test projects. It affects both MSTest and xUnit projects.

@singhsarab
Copy link
Contributor

@Grauenwolf Can you please add some more details. What is the version of dotnet cli and VS on the machine? I am assuming you are able to reproduce the issue using a simple unit test project.

@singhsarab
Copy link
Contributor

@Grauenwolf Are you still facing this issue ?

@Grauenwolf
Copy link
Author

Grauenwolf commented Oct 11, 2019

I just retested with a clean project and it is still happening.

UnitTestProject2.zip

VS: 16.3.2
Core: 3.0.100

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
    <PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
    <PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
    <PackageReference Include="coverlet.collector" Version="1.1.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

@singhsarab
Copy link
Contributor

@Grauenwolf I am sorry, not able to reproduce the issue.
I tried on VS 16.3.5 using the project that you shared.

@singhsarab
Copy link
Contributor

Closing this issue for now. Please share more details so we can help diagnose this.

@MarkBrainfire
Copy link

I have the same issue.

@Evangelink
Copy link
Member

@MarkBrainfire Could you please give us more details? Which version is working and which version isn't? Do you have any repro you could share with us? Thanks

@MarkBrainfire
Copy link

MarkBrainfire commented Jul 23, 2022

@Evangelink

I solved the problem by updating Microsoft.NET.Test.Sdk from 17.1.0 to 17.2.0 (or above)

DETAILS:
I'm using C# / .NET 6 / VS 17.3.0 Preview 4
The current XUnit project template imports:
Microsoft.NET.Test.Sdk (17.1.0)
xunit (2.4.1)
xunit.runner.visualstudio (2.4.3)

The error message "Program does not contain a static 'Main" method suitable for an entry point" goes away when the Microsoft.NET.Test.Sdk is updated to either 17.2.0 (or the preview 17.4.0). Updating xunit and xunit.runner.visualstudio doesn't have any impact on this problem.

@MoaidHathot
Copy link

I started getting this issue suddenly in 17.8.0. Reverting to 17.7.2 solves it...
It is important to mention that the issue did not reproduce immediately, but that it started showing up without any apparent reason or relevant code changes.

@nohwnd
Copy link
Member

nohwnd commented Feb 5, 2024

@MoaidHathot Do you have a repro please?

@talhashoaib
Copy link

I am facing the same issue with version 17.13.0 and downgrading to 17.12.0 solves it. Actual reason unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants