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

Set IsPackable=false for new test projects #377

Merged

Conversation

tintoy
Copy link
Contributor

@tintoy tintoy commented Feb 26, 2017

Hi :)

I'm opening this PR so there's something a little more concrete to discuss for #376.

To summarise the discussion so far:

  • The rationale for this is that creating NuGet packages from tests is probably not the more-common use case and so by default these project should not participate when "dotnet pack" is run at the solution level.
  • Some users do want to create packages for their tests, and this change doesn't prevent them from doing so if they explicitly opt into it.

Open questions:

  • Should this be configurable via a template parameter (e.g. --packable or --enable-packaging)?
  • Er, sorry, GitHub's saying that every line in those files has changed, but as far as I can tell that's not the case (I only changed the IsPackable line). I'm on a Mac, so perhaps it's a CR/LF issue? If so, could someone using Windows let me know and I'll fiddle with Git's autocrlf and try again.

@tintoy tintoy force-pushed the tintoy/test-projects-no-pack branch from 77a277f to a019da2 Compare February 26, 2017 09:30
@mlorbetske mlorbetske changed the base branch from master to rel/vs2017/post-rtw February 27, 2017 08:48
@mlorbetske
Copy link
Contributor

@tintoy would you mind rebasing onto rel/vs2017/post-rtw? Also, from the conversation in #376, it sounds like this will be turned off in the test SDK by default at some point, perhaps this should be included as an option to turn it on instead?

<IsPackable Conditon="'$(EnablePack)' == 'true'">true</IsPackable>

+a parameter added to the template.json files (type: bool, default: false) and a mapping for the CLI (in dotnetcli.host.json) for -p|--enable-pack

If there's a reason to not wait until the test SDK update, there's also this option (with the same changes in template.json & the host specific file)

<IsPackable Conditon="'$(EnablePack)' != 'true'">false</IsPackable>
<IsPackable Conditon="'$(EnablePack)' == 'true'">true</IsPackable>

Thoughts?

@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

Sure, no problem - that makes sense to me :)

I'll give that a go tomorrow morning.

@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

BTW, where does $(EnablePack) come from? Is that something we'll define elsewhere, or is that something else from the project system?

The rationale for this is that creating NuGet packages from tests is probably not the more-common use case and so by default these project should not participate when "dotnet pack" is run at the solution level.

This doesn't prevent users from opting into "dotnet pack", it simply won't be the default.
@tintoy tintoy force-pushed the tintoy/test-projects-no-pack branch from a019da2 to d214053 Compare February 27, 2017 09:08
@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

Rebasing.

@mlorbetske
Copy link
Contributor

@tintoy in MSBuild files, you can refer to symbols defined in template.json like any other MSBuild property in conditions - if the only references a Condition contains refer to symbols from template.json, they'll be evaluated as part of template generation.

Example:
Project file:
https://github.com/dotnet/templating/blob/master/template_feed/Microsoft.DotNet.Web.ProjectTemplates.1.x/content/StarterWeb-CSharp/Company.WebApplication1.csproj#L4-L6

Declarations in template.json
https://github.com/dotnet/templating/blob/master/template_feed/Microsoft.DotNet.Web.ProjectTemplates.1.x/content/StarterWeb-CSharp/.template.config/template.json#L78-L92 (Framework)
https://github.com/dotnet/templating/blob/master/template_feed/Microsoft.DotNet.Web.ProjectTemplates.1.x/content/StarterWeb-CSharp/.template.config/template.json#L42-L61 (auth and the computed value IndividualAuth)

@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

Interesting! I had no idea it could do that :)

That'll make a lot of things simpler.

@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

Ok - would you mind having a look at d3bda09? If that's what you mean, I'll have a go at applying it to the rest tomorrow morning.

@mlorbetske
Copy link
Contributor

Beautiful, jfyi there's a setting for controlling short name generation too (I think it's "shortname" but it's entirely possible that I'm remembering wrong), you could use that to manually control the short switch. As it is now, this will generate -ep|--enable-pack as a command line option

@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

Great! I'll look it up and use it. Are you ok with -p ?

…t#377).

This parameter, if set to "true", marks the project as packable (i.e. participates in solution-level calls to "dotnet pack", producing a NuGet package).
@tintoy
Copy link
Contributor Author

tintoy commented Feb 27, 2017

Ok, I think that's all of them :)

@tintoy tintoy changed the title [WIP] Set IsPackable=false for new test projects Set IsPackable=false for new test projects Feb 27, 2017
@mlorbetske
Copy link
Contributor

Cc @codito

@codito
Copy link

codito commented Mar 1, 2017

👍 thanks!

@mlorbetske mlorbetske merged commit 513533e into dotnet:rel/vs2017/post-rtw Mar 1, 2017
@mlorbetske
Copy link
Contributor

Thanks @tintoy!

seancpeters pushed a commit that referenced this pull request Mar 9, 2017
* Tags become choices, lots of help changes

* Rebased on rel/sv2017/post-rtw

* Post-Rebase cleanup of outputs for various situations. Moved tags to symbols on 2.0 templates

* Reverted to tags in 1.x templates and Item templates

* Removed extra space from tags secifications in 1.x templates

* Reverted to tags in 2.0 templates

* Fixed misspelling of 'language' in 2.0 template.json files

* Changes based on review comments (not including case-insensitive reads yet)

* Rebased on rel/vs2017/post-rtw

* Made reading template config & cache info be case-insensitive.

* Made cache parameter properties get only

* Cleanup of help & ItemplateInfo

* Minor cleanup, mostly removing no longer needed async tasks

* More cleanup

* Tags become choices, lots of help changes

* Rebased on rel/sv2017/post-rtw

* Post-Rebase cleanup of outputs for various situations. Moved tags to symbols on 2.0 templates

* Reverted to tags in 1.x templates and Item templates

* Removed extra space from tags secifications in 1.x templates

* Reverted to tags in 2.0 templates

* Fixed misspelling of 'language' in 2.0 template.json files

* Cleaning up UI interactions. Better experience for: problems with extra args files (#327, #329); default not in choice list #271

* Added support for split template configuration files (#150)

* Cleanup of nulls in the template cache

* fixed a merge mistake

* More fixes from merge issues

* Make fallback host files work correctly

* Added wildcard to host matched. Fixed a bug with wildcard matching in zips

* Add filter switch, hide all switch, add logic for accepting explicitly set filters

* Change filter to type

* Give instructions to call --help instead of showing help on error

* Remove unused using

* Fixes #380 and #379

* Respond to review feedback

* Make the message shown for the invalid params match between help and non-help cases

* Set IsPackable=false for new test projects (#376).

The rationale for this is that creating NuGet packages from tests is probably not the more-common use case and so by default these project should not participate when "dotnet pack" is run at the solution level.

This doesn't prevent users from opting into "dotnet pack", it simply won't be the default.

* Make IsPackable configurable for test project template (#377).

* Use '-p' as the short form for '--enable-pack' in MSTest v1 project template.

* Implement "--enable-pack" parameter for test project templates (#377).

This parameter, if set to "true", marks the project as packable (i.e. participates in solution-level calls to "dotnet pack", producing a NuGet package).

* Build for non-Windows platforms

Refactor to use latest cli

Add RestoreSource for dotnet-new3 project

Build with framework version and runtime id

Fix test cases

* Move testbase location to local directory

* Updating the identity of the 2.0 templates

* Better matching across templates with same group identity.

* Added precedence to all template.json files

* Reading & writing template Precedence

* Template matching uses Precedence to help disambiguate templates

* fix for #395

* Updated package refs in test projects

* fix for exclude, include, & copy only configuration in sources

* Mikes test harness for testing dotnet new commands. Tests for precedence disambiguation

* Fixes per Mike's CR

* renamed the mvc precendence tests

* Add 3PN for nuget.exe

* Allow runtime to be passed in

* Handling reading different cache formats, and upgrading the cache aut… (#407)

* Handling reading different cache formats, and upgrading the cache automatically as needed

* Cleanup for cache versioning

* Improvements to cache versioning. Language display fix.

* Cache rebuild enhancement. Only scan mount points for templates and langpacks
GangWang01 pushed a commit to GangWang01/sdk that referenced this pull request Jun 27, 2022
* Tags become choices, lots of help changes

* Rebased on rel/sv2017/post-rtw

* Post-Rebase cleanup of outputs for various situations. Moved tags to symbols on 2.0 templates

* Reverted to tags in 1.x templates and Item templates

* Removed extra space from tags secifications in 1.x templates

* Reverted to tags in 2.0 templates

* Fixed misspelling of 'language' in 2.0 template.json files

* Changes based on review comments (not including case-insensitive reads yet)

* Rebased on rel/vs2017/post-rtw

* Made reading template config & cache info be case-insensitive.

* Made cache parameter properties get only

* Cleanup of help & ItemplateInfo

* Minor cleanup, mostly removing no longer needed async tasks

* More cleanup

* Tags become choices, lots of help changes

* Rebased on rel/sv2017/post-rtw

* Post-Rebase cleanup of outputs for various situations. Moved tags to symbols on 2.0 templates

* Reverted to tags in 1.x templates and Item templates

* Removed extra space from tags secifications in 1.x templates

* Reverted to tags in 2.0 templates

* Fixed misspelling of 'language' in 2.0 template.json files

* Cleaning up UI interactions. Better experience for: problems with extra args files (dotnet#327, dotnet#329); default not in choice list dotnet#271

* Added support for split template configuration files (dotnet#150)

* Cleanup of nulls in the template cache

* fixed a merge mistake

* More fixes from merge issues

* Make fallback host files work correctly

* Added wildcard to host matched. Fixed a bug with wildcard matching in zips

* Add filter switch, hide all switch, add logic for accepting explicitly set filters

* Change filter to type

* Give instructions to call --help instead of showing help on error

* Remove unused using

* Fixes dotnet#380 and dotnet#379

* Respond to review feedback

* Make the message shown for the invalid params match between help and non-help cases

* Set IsPackable=false for new test projects (dotnet/templating#376).

The rationale for this is that creating NuGet packages from tests is probably not the more-common use case and so by default these project should not participate when "dotnet pack" is run at the solution level.

This doesn't prevent users from opting into "dotnet pack", it simply won't be the default.

* Make IsPackable configurable for test project template (dotnet/templating#377).

* Use '-p' as the short form for '--enable-pack' in MSTest v1 project template.

* Implement "--enable-pack" parameter for test project templates (dotnet/templating#377).

This parameter, if set to "true", marks the project as packable (i.e. participates in solution-level calls to "dotnet pack", producing a NuGet package).

* Build for non-Windows platforms

Refactor to use latest cli

Add RestoreSource for dotnet-new3 project

Build with framework version and runtime id

Fix test cases

* Move testbase location to local directory

* Updating the identity of the 2.0 templates

* Better matching across templates with same group identity.

* Added precedence to all template.json files

* Reading & writing template Precedence

* Template matching uses Precedence to help disambiguate templates

* fix for dotnet#395

* Updated package refs in test projects

* fix for exclude, include, & copy only configuration in sources

* Mikes test harness for testing dotnet new commands. Tests for precedence disambiguation

* Fixes per Mike's CR

* renamed the mvc precendence tests

* Add 3PN for nuget.exe

* Allow runtime to be passed in

* Handling reading different cache formats, and upgrading the cache aut… (dotnet#407)

* Handling reading different cache formats, and upgrading the cache automatically as needed

* Cleanup for cache versioning

* Improvements to cache versioning. Language display fix.

* Cache rebuild enhancement. Only scan mount points for templates and langpacks
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

Successfully merging this pull request may close these issues.

3 participants