-
Notifications
You must be signed in to change notification settings - Fork 107
Multi project with solution file #17
Comments
@seancpeters can you post a sample .sln file which has a conditional project entry? |
At this point, to create conditions in a solution file so that the .sln file remains syntactically correct requires setting up a custom operation configuration in the template.json file. But this PR dotnet/templating#979 will provide better built in support for .sln files. Once this is merged, it'll become easier. Current Situation A custom conditional setup must be configured in the template.json, the following can be copied as-is:
The key “SpecialCustomOperations” is a top-level key, and so should appear at the same level as things such as “identity” & “tags”. This configuration defines the syntax of conditional operations in “*.sln” files. The style is “line” to indicate we’re defining line-comments (as opposed to block comments, such as “” comments). The token value of “#” indicates what the conditional keywords will be preceded with. Template engine conditional operations come in two styles, “regular” and ”actionable”. Both styles operate in the same manner in terms of being conditional. The difference is that the “actionable” ones get a comment stripped from each line of their content if the content is emitted (this is the same as the built-in conditional operations). The format of the operations will be:
With this configuration, a .sln file can be conditioned similarly to any other file in a template. The following demonstrates optionally including various projects in a solution:
Near Future
|
any update? |
@a-patel The "Near Future" scenario from my previous post has been merged, and is available in 2.1.0-preview1 or newer builds. The syntax for .sln file comments shown in the above post is built in, and doesn't need to be configured in template.json |
Can I create the 'Multi project with solution file' (ASP.Net Core 2.0) using SidewaffleCreator2017 |
My Directory structure is like: |- data
|
Yes it should work. Let us know if you run into any issues. |
Is there a tutorial that takes you through how to create a solution template step by step? thanks |
Not that I'm aware of. |
I managed to get my project template to create the folder structure I want and a .sln file ie: |-src
It works as I wish using dotnet new, but I use the same template in vsix with sidewaffle and I end up with 2 .sln files and a folder structure nested one level deeper than I want, ie I get: |-WebApp
I know this is a little off topic since not directly an issue with dotnet new template, but hoping someone here might have some tips. I would like to prevent VS/vsix/sidewaffle from creating a .sln file and instead use the one already included in the template. If anyone here knows how to do that I would greatly appreciate the help. |
Hi all We're basically trying to build a Service Template solution for .net core "micro" services. However, ideally we would want to open the solution to continue to refine our service template over time. But every time we make a change resulting in changes to the solution file, once we save using Visual Studio (currently 15.9.3), it will remove the if-tags. We usually notice and revert the changes before commit, but it's somewhat of a hassle. Is there a work-around for this or are we not using it correctly? I have also tried with double-#, but it doesn't affect the outcome. Example:
|
Create a template which is https://github.com/dotnet/dotnet-template-samples/tree/master/05-multi-project plus a solution file.
Since the unit test is optional this will also show optional content in the .sln file.
The text was updated successfully, but these errors were encountered: