dotnet / dotnet-template-samples

Samples showing how to create templates using the Template Engine for dotnet new and Visual Studio

Home Page:https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-new

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handling optional project ref in .sln files?

jdkang opened this issue · comments

I'm looking to use dotnet new to help template both old VS solutions and new dotnet type projects.

See also: VS Solution File

When manipulating an .sln for inclusion of OPTIONAL projects (i.e. giving the user the option for sub projects such as Foo.Data/Foo.Data.csproj) the .sln file would need its references updated/omitted.

In yeoman/npm

In yeoman/npm this is handled with inline code.

	GlobalSection(ProjectConfigurationPlatforms) = postSolution<% for(var project in projects) { %>
		{<%= projects[project].projectGuid %>}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{<%= projects[project].projectGuid %>}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{<%= projects[project].projectGuid %>}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{<%= projects[project].projectGuid %>}.Release|Any CPU.Build.0 = Release|Any CPU<% } %>