"A <Choose> must contain at least one <When>." (MSB4085)
See original GitHub issueI get this msbuild error after trying to turn a VS 2015 solution into a template. My template.json is very simple, as in the example, here:
https://github.com/dotnet/templating/wiki/%22Runnable-Project%22-Templates
Running dotnet new -i ./MySolutionDir
works fine. The error happens when I try to load the solution in VS. Running diff on the .csproj files before and after using them in the template, I see that somewhere along the way, certain <Choose> tags are emptied (probably fine?), but not removed.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Fra Fra CSV .NETFramework2.0SP1 | PDF
"The state server has closed an expired TCP/IP connection. The IP address of the client is %1.%2. ... "MSB4085: A <Choose> must contain...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm this works for me. I ended up wrapping large swaths of my .csproj files in the <!–/-:cnd:noEmit --><!–/+:cnd:noEmit --> since there are a lot of conditions, and not only on the Choose/Whens. I left alone the sections needed for guid replacements. The end result is that I now have a working solution template with a lot less fuss than other templating options out there. 😃
Thanks, again, for all your help @seancpeters, @mlorbetske and @sayedihashimi.
Happy to help @cdibbs, thanks for making templates!