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

OutputType in test project templates #287

Closed
codito opened this issue Dec 17, 2016 · 7 comments
Closed

OutputType in test project templates #287

codito opened this issue Dec 17, 2016 · 7 comments

Comments

@codito
Copy link
Contributor

codito commented Dec 17, 2016

Description

There is confusion around multitargeted test projects in issues. For netcoreapp1.x, <OutputType>Exe</OutputType> is required (see dotnet/sdk#201 for rationale), where as for netXY target, library OutputType is recommended.

If user adds <OutputType>Exe</OutputType> unconditionally, they need to add an RID parameter for netXY target. In case they add win7-x64, IDE doesn't discover tests by default because by default IDE considers x86 as default platform bitness. We can't get rid of this problem easily as long RID is necessary for a netXY exe.

Possible fixes

  1. Change the default project template to conditional <OutputType Condition=" $(TargetFramework.StartsWith('netcoreapp') ">Exe</OutputType> (see Test projects sometimes require <OutputType>Exe</OutputType> #191 (comment))
  2. Do something similar to (1) in Microsoft.NET.Test.Sdk
  3. I believe we're doing work in dotnet-sdk to remove the RID requirement. If this ensures the emitted binary is AnyCpu, there is no change required in templates.
  4. Document and allow users to modify their projects

Thoughts?

Related issues:
#191
https://github.com/dotnet/cli/issues/4837
dotnet/project-system#827

@codito
Copy link
Contributor Author

codito commented Dec 17, 2016

@livarcocc @srivatsn @piotrpMSFT @natemcmaster thoughts?

@codito
Copy link
Contributor Author

codito commented Dec 20, 2016

Triage: go with option 2.

Implementation: find the right place to override OutputType. It should be done before other parts of SDK look into OutputType. Also change the PackageReference to SDK for NET.Test.Sdk in templates.

@srivatsn
Copy link

Yes defaulting this in the SDK makes sense. Users shouldn't have to fiddle with this. We are getting rid of the RID requirement entirely but will just infer the RID as needed. Getting rid of the rid will require a significant change to analyze all dependencies to see if any of them carry native resources.

@natemcmaster
Copy link
Contributor

Sorry for delayed response, but yes, I agree with your triage choice. This seems like a good approach.

@codito
Copy link
Contributor Author

codito commented Jan 9, 2017

@natemcmaster @NTaylorMullen this fix should be available in latest dotnet-cli dev builds. Test project need not specify OutputType. Can you please try it out?

@codito
Copy link
Contributor Author

codito commented Jan 9, 2017

Closing this issue, please reopen if you still observe the issue.

@codito codito closed this as completed Jan 9, 2017
@natemcmaster
Copy link
Contributor

Confirmed fixed in Microsoft.NET.Test.Sdk 15.0.0-preview-20170106-0 (cref dotnet/cli#5234).

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

No branches or pull requests

6 participants