ThinkSharp.Solutions is a small Visual Studio Extension that allows to create a new solution from a template. The template is a prepared solution located in a git repository. It may contain place holders that are replaced with custom values after cloning.
Download latest release: https://github.com/JanDotNet/ThinkSharp.Solutions/releases and install it.
Note that ThinkSharp.Solutions is currently available for Visual Studio 2015 and 2017 only.
- Start a new instance of Visual Studio 2015
- Klick Tools -> Create Solution from Template
- Enter the HTTPS URL of the git repository and the target directory into the dialog and press "Clone Template". Note that cloning with git url (e.g. git@github.com...) is not supported.
The solution will be copied into the entered target directory.
- Enter replacements and press "Replace Placeholders"
All placeholders will be replaced in all files (file content) as well as directory and file names. If "Open Solution" is checked, the solution will be opend.
Create a new solution and replace all configurable text fragments with placeholders. "configurable text fragments" may be text within file content or file / directory names.
There is also a working sample available: https://github.com/JanDotNet/ThinkSharp.Solutions.ExampleTemplate
- Create a file "TemplateDefinition.xml" on root level (same directory where the '.git' directory is)
- Define all placeholders within the template definition file as shown below:
<?xml version="1.0" encoding="utf-8" ?>
<TemplateDefinition>
<Placeholders>
<Placeholder Name="MODULE"
Description="The module the micro service belongs to."
SuggestionList="Module01, Module02, Module03" />
<Placeholder Name="MICROSERVICE"
Description="The name of the microservice" />
<Placeholder Name="PORT"
TextToReplace="999999"
Description="The name of the microservice" />
</Placeholders>
<Examples>
<Example Header="AssemblyName" Text="Company.Department.MODULE.MICROSERVICE.dll" />
<Example Header="Namespace" Text="namespace Company.Department.MODULE.MICROSERVICE" />
<Example Header="Service" Text="public class MICROSERVICEService" />
<Example Header="URL" Text="http://localhost:999999/index.html" />
</Examples>
</TemplateDefinition>The value of TextToReplace is the text that will be replaced. If TextToReplace is not set, the value of Name will be used instead. The SuggestionList is a comma-separated list that will be provided to the user as replacements when creating the solution from template.
The examples will be shown on the dialog where the place holders are entered. They can be used to give the user a preview of the template parts affected by the place holders.
GUID placeholders are valid GUIDs so that the template remains buildable. There are 2 types of special GUID placeholders that can be used.
NewGuid Placeholder
All occurencies of the GUID "00000000-1111-0000-1111-000000000000" will be replaced by a new generated GUID using Guid.New(). This placeholder provides a simple way to generate new guids.
NewCachedGuid Placeholder
All occurencies of the GUID "00000000-1111-0000-1111-[0-9a-f]{12}" will be replaced by a new generated or cached GUID. That means, that 2 occurencies of the placeholder "00000000-1111-0000-1111-000000000001" will be replaced by the same GUID. Therefore, this placeholder provides a way to use the same new generated GUID multiple times.
In case of errors, the log file is located in "%AppData%\ThinkSharp\Solutions"
ThinkSharp.Solutions is released under The MIT license (MIT)
We use SemVer for versioning. For the versions available, see the tags on this repository.
If you like ThinkSharp.Solutions, feel free to give me a cup of coffee :)


