question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"A <Choose> must contain at least one <When>." (MSB4085)

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cdibbscommented, Apr 24, 2017

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.

0reactions
mlorbetskecommented, Apr 25, 2017

Happy to help @cdibbs, thanks for making templates!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found