Skip to content

Commit cae6338

Browse files
v1.1.0 (#5)
- Add Razor component template with code behind, including the header with the company (fix #3). - Fix the name of the file when using a "razor.cs" suffix (fix #4). - Use the company specified in the `stylecop.json` file if specified (fix #2).
1 parent c229b47 commit cae6338

19 files changed

+269
-73
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ will be:
4141
It is not easy to have manage and have different templates for each customers.
4242

4343
To fix this issue and allow to work with different companies with the same Visual Studio instance, these
44-
templates will ask you the name of the company to put on the header.
44+
templates, will read the `stylecop.json` file in your project and extract the company name.
45+
See the [Configuring StyleCop Analyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md)
46+
for more information.
47+
48+
If no `stylecop.json` file exists, a wizard will be displayed to ask you the name of the company to put on the header.
4549

4650
![Ask Company](docs/AskCompany.png)
4751

4852
### Companies settings file
4953

50-
The company name is asked only once for each solution.
54+
If there is no `stylecop.json` file associated to the project, the company name is asked
55+
only once for each solution stored in your computer.
5156
The association between the company and the solutions are saved in the following mapping file:
5257

5358
```
@@ -70,6 +75,8 @@ The [PosInformatique.VisualStudio.Templates.sln](PosInformatique.VisualStudio.Te
7075
- [Exception.cs](./src/VisualStudio.Templates.Files/Exception.cs): C# exception class
7176
- [ExceptionUnitTest.cs](./src/VisualStudio.Templates.Files/ExceptionUnitTest.cs): C# exception unit test class
7277
- [Interface.cs](./src/VisualStudio.Templates.Files/Interface.cs): C# interface
78+
- [RazorComponent.razor](./src/VisualStudio.Templates.Files/RazorComponent.razor): Razor component (a separate code behind C# class is included)
79+
- [RazorComponent.razor.cs](./src/VisualStudio.Templates.Files/RazorComponent.razor.cs): Razor component code behind (in C#).
7380
- [XUnitTest.cs](./src/VisualStudio.Templates.Files/XUnitTest.cs): C# XUnit test class
7481

7582
![Templates](docs/Templates.png)

build/azure-pipelines-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ parameters:
22
- name: Version
33
displayName: The version of the Visual Studio Templates
44
type: string
5-
default: 1.0.0.0
5+
default: 1.1.0.0
66

77
trigger: none
88

docs/Templates.png

6.8 KB
Loading

src/VisualStudio.Templates.Files/Class.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//-----------------------------------------------------------------------
2-
// <copyright file="$safeitemname$.cs" company="$company$">
2+
// <copyright file="$rootname$" company="$company$">
33
// Copyright (c) $company$. All rights reserved.
44
// </copyright>
55
//-----------------------------------------------------------------------

src/VisualStudio.Templates.Files/Exception.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//-----------------------------------------------------------------------
2-
// <copyright file="$safeitemname$.cs" company="$company$">
2+
// <copyright file="$rootname$" company="$company$">
33
// Copyright (c) $company$. All rights reserved.
44
// </copyright>
55
//-----------------------------------------------------------------------

src/VisualStudio.Templates.Files/ExceptionUnitTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//-----------------------------------------------------------------------
2-
// <copyright file="$safeitemname$.cs" company="$company$">
2+
// <copyright file="$rootname$" company="$company$">
33
// Copyright (c) $company$. All rights reserved.
44
// </copyright>
55
//-----------------------------------------------------------------------

src/VisualStudio.Templates.Files/Interface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//-----------------------------------------------------------------------
2-
// <copyright file="$safeitemname$.cs" company="$company$">
2+
// <copyright file="$rootname$" company="$company$">
33
// Copyright (c) $company$. All rights reserved.
44
// </copyright>
55
//-----------------------------------------------------------------------
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@namespace $rootnamespace$
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="$rootname$" company="$company$">
3+
// Copyright (c) $company$. All rights reserved.
4+
// </copyright>
5+
//-----------------------------------------------------------------------
6+
7+
namespace $rootnamespace$
8+
{
9+
public partial class $safeitemname$
10+
{
11+
public $safeitemname$()
12+
{
13+
}
14+
}
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
3+
<TemplateData>
4+
<DefaultName>Component.razor</DefaultName>
5+
<Name>P.O.S Informatique Razor Component (with code behind)</Name>
6+
<Description>P.O.S Informatique Razor Component (with code behind).</Description>
7+
<ProjectType>CSharp</ProjectType>
8+
<SortOrder>150</SortOrder>
9+
<Icon Package="{AAB75614-2F8F-4DA6-B0A6-763C6DBB2969}" ID="13" />
10+
<TemplateGroupID>AspNetCore</TemplateGroupID>
11+
</TemplateData>
12+
<TemplateContent>
13+
<ProjectItem SubType="" TargetFileName="$fileinputname$.razor" ReplaceParameters="true">RazorComponent.razor</ProjectItem>
14+
<ProjectItem SubType="" TargetFileName="$fileinputname$.razor.cs" ReplaceParameters="true">RazorComponent.razor.cs</ProjectItem>
15+
</TemplateContent>
16+
<WizardExtension>
17+
<Assembly>PosInformatique.VisualStudio.Templates, Version=0.0.0.0, Culture=Neutral, PublicKeyToken=889b4f35d1c32a46</Assembly>
18+
<FullClassName>PosInformatique.VisualStudio.Templates.CompanySelectionWizard</FullClassName>
19+
</WizardExtension>
20+
</VSTemplate>

0 commit comments

Comments
 (0)