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.cs is getting added to full clr test project. #608

Closed
harshjain2 opened this issue Mar 13, 2017 · 0 comments · Fixed by dotnet/cli#6319
Closed

Program.cs is getting added to full clr test project. #608

harshjain2 opened this issue Mar 13, 2017 · 0 comments · Fixed by dotnet/cli#6319

Comments

@harshjain2
Copy link
Contributor

harshjain2 commented Mar 13, 2017

Description

Program.cs is getting added to full clr test project. Program.cs is required in case of netcoreapp tests, but not for full clr test projects.

Steps to reproduce

Create a new .net core test project.
Change the Target Framework to net46.
Build the solution.
Open the obj\net46\ folder.

Expected behavior

{ProjectName}.Program.cs should not be present.

Actual behavior

{ProjectName}.Program.cs is present.

Root Cause Analysis : We are now adding this (https://github.com/Microsoft/vstest/blob/master/src/package/nuspec/Microsoft.NET.Test.Sdk.targets) targets file for both netcoreapp and net46 tfms. Earlier we used it only for netcoreapp tfm.

Conditionally adding the program.cs based on tfm should fix this.

@harshjain2 harshjain2 added the bug label Mar 13, 2017
@codito codito added this to the Preview 115.3 - 20170324 milestone Mar 22, 2017
Faizan2304 pushed a commit to Faizan2304/vstest that referenced this issue Mar 27, 2017
Fix: Inject entry point only for project targeting netcoreapp1.0
Faizan2304 added a commit that referenced this issue Mar 28, 2017
Issue: #608
Fix: Inject entry point only for project targeting netcoreapp1.0
jamill added a commit to jamill/VFSForGit that referenced this issue Jan 3, 2019
Tweak GVFS.UnitTests.csproj to work with the dotnet test command. The following
scenario should work:

  Running the command "dotnet test" on the GVFS.UnitTest project should build
  and run the assocated unit tests.

Several changes are required to enable this scenario:

1) Do not Generate program file

Our test project generates its own executable, which conflict with the default
configuration of the vstest framework for netcoreapps. According to the links
below, netcoreapps require a Program.cs, which is not usually included in test
projects. Because of this, vstest implicity  adds this file for dotnetcore
apps, which is conflicting with the explicitly included Program.cs we define.

The suggested fix is to supress the automatic injection of the entry point via
the "GenerateProgramFile" property.

Links:

microsoft/vstest#636
microsoft/vstest#608

2) Add PackageReference to Microsoft.NET.Test.SDK

This is required for dotnet test to discover tests

3) Add PackageReference to NUnit3TestAdapter

This is required to integrate NUnit tests with the test discovery / execution
framework.
jamill added a commit to jamill/VFSForGit that referenced this issue Jan 5, 2019
Tweak GVFS.UnitTests.csproj to work with the dotnet test command. The following
scenario should work:

  Running the command "dotnet test" on the GVFS.UnitTest project should build
  and run the assocated unit tests.

Several changes are required to enable this scenario:

1) Do not Generate program file

Our test project generates its own executable, which conflict with the default
configuration of the vstest framework for netcoreapps. According to the links
below, netcoreapps require a Program.cs, which is not usually included in test
projects. Because of this, vstest implicity  adds this file for dotnetcore
apps, which is conflicting with the explicitly included Program.cs we define.

The suggested fix is to supress the automatic injection of the entry point via
the "GenerateProgramFile" property.

Links:

microsoft/vstest#636
microsoft/vstest#608

2) Add PackageReference to Microsoft.NET.Test.SDK

This is required for dotnet test to discover tests

3) Add PackageReference to NUnit3TestAdapter

This is required to integrate NUnit tests with the test discovery / execution
framework.
jamill added a commit to jamill/VFSForGit that referenced this issue Jan 7, 2019
Tweak GVFS.UnitTests.csproj to work with the dotnet test command. The following
scenario should work:

  Running the command "dotnet test" on the GVFS.UnitTest project should build
  and run the assocated unit tests.

Several changes are required to enable this scenario:

1) Do not Generate program file

Our test project generates its own executable, which conflict with the default
configuration of the vstest framework for netcoreapps. According to the links
below, netcoreapps require a Program.cs, which is not usually included in test
projects. Because of this, vstest implicity  adds this file for dotnetcore
apps, which is conflicting with the explicitly included Program.cs we define.

The suggested fix is to supress the automatic injection of the entry point via
the "GenerateProgramFile" property.

Links:

microsoft/vstest#636
microsoft/vstest#608

2) Add PackageReference to Microsoft.NET.Test.SDK

This is required for dotnet test to discover tests

3) Add PackageReference to NUnit3TestAdapter

This is required to integrate NUnit tests with the test discovery / execution
framework.
jamill added a commit to jamill/VFSForGit that referenced this issue Jan 8, 2019
Tweak GVFS.UnitTests.csproj to work with the dotnet test command. The following
scenario should work:

  Running the command "dotnet test" on the GVFS.UnitTest project should build
  and run the assocated unit tests.

Several changes are required to enable this scenario:

1) Do not Generate program file

Our test project generates its own executable, which conflict with the default
configuration of the vstest framework for netcoreapps. According to the links
below, netcoreapps require a Program.cs, which is not usually included in test
projects. Because of this, vstest implicity  adds this file for dotnetcore
apps, which is conflicting with the explicitly included Program.cs we define.

The suggested fix is to supress the automatic injection of the entry point via
the "GenerateProgramFile" property.

Links:

microsoft/vstest#636
microsoft/vstest#608

2) Add PackageReference to Microsoft.NET.Test.SDK

This is required for dotnet test to discover tests

3) Add PackageReference to NUnit3TestAdapter

This is required to integrate NUnit tests with the test discovery / execution
framework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants