Skip to content

Visual Studio code templates for P.O.S Informatique and also for its customers or project partners.

License

Notifications You must be signed in to change notification settings

PosInformatique/PosInformatique.VisualStudio.Templates

Repository files navigation

P.O.S Informatique Visual Studio Templates

This repository contains Visual Studio templates of P.O.S Informatique company and can be used as white label when working for different customers.

These templates follow the StyleCop and Microsoft coding conventions.

White label companies of the templates

If you work in a Digital Services Company with multiple customers, the source code edited belong to your customer and maybe you have to write the customer company name on the header.

For example, for the P.O.S Informatique company:

//-----------------------------------------------------------------------
// <copyright file="CustomerManager.cs" company="P.O.S Informatique">
//     Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

If you switch to another customer called Chantier Connect, the header of the C# files will be:

//-----------------------------------------------------------------------
// <copyright file="CustomerManager.cs" company="Chantier Connect">
//     Copyright (c) Chantier Connect. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

It is not easy to have manage and have different templates for each customers.

To fix this issue and allow to work with different companies with the same Visual Studio instance, these templates, will read the stylecop.json file in your project and extract the company name. See the Configuring StyleCop Analyzers for more information.

If no stylecop.json file exists, a wizard will be displayed to ask you the name of the company to put on the header.

Ask Company

Companies settings file

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

C:\Users\<Windows user>\AppData\Local\P.O.S Informatique\Visual Studio\Templates\Companies.json

If you need to reset the mapping association between the company and solutions, just delete this file. The Visual Studio extension will ask you again the name of the company when adding a file with the template.

NOTE: We use this strategy in order to avoid be intrusive in your repository source code by saving additional information (inside file, .sln,...) for this extension. We would like that the source codes of the respository must be separated of the Visual Studio extensions used.

Visual Studio item templates

The PosInformatique.VisualStudio.Templates.sln solution contains 2 projects:

Templates

Packaging of the Visual Studio Templates

The VisualStudio.Templates.package.proj file is a MSBuild script which allows to perform the following operations:

  • Build the VSIX package of the Visual Studio Templates
  • Generate the ATOM file used to publish the Visual Studio extension inside a private extensions gallery.

Build the VSIX package.

To build the VSIX package:

  • Open the Developer Command Prompt for VS2022.
  • Go to the root directory of the repository.
  • Execute the following command:
msbuild PosInformatique.VisualStudio.Templates.package.proj /t:Build /p:OutDir="<Output folder>"

With <Output folder> the folder where the VSIX package.

Generate the ATOM feed for the private extensions gallery.

To generate the ATOM feed:

  • Open the Developer Command Prompt for VS2022.
  • Go to the root directory of the repository.
  • Execute the following command:
msbuild PosInformatique.VisualStudio.Templates.package.proj /t:Publish /p:OutDir="<Output folder>" /p:PublishUrl="<Publish URL>"

With:

  • <Output folder> the folder where the VSIX package and the ATOM feed will be generated
  • <Publish URL> the URL where you would like to publish your extensions in private extensions gallery.

Build and deploy the Visual Studio templates

To deploy the Visual Studio you can use the build/azure-pipelines-release.yaml Azure Pipeline YAML provided in the repository.

This Azure Pipeline YAML allows to publish the Visual Studio Templates extensions inside an Azure Web App and required 1 parameter:

  • Version: The version of the Visual Studio Templates extensions to build.

And 2 variables:

  • AzureSubscription: The name of the Azure Subscription which contains the Azure Web App
  • WebAppName: The name of the Azure Web App where to publish the extensions.

The extensions will be publish inside a sub folder named visualstudio-extensions.

The extensions after published will be available in private extensions gallery with the following URL: https://<WebAppName>.azurewebsites.net/visualstudio-extensions/.

NOTE: You do not need to fork this repository, you can plug this repository to you own Azure Pipeline.

Install the Visual Studio Templates

In the case your the extension is deployed in a private extensions gallery.

To install the Visual Studio Templates, add the P.O.S Informatique extension gallery:

  • Click to the Tools/Options menu.
  • Add an additional extension gallery with the following settings:
    • Name: P.O.S Informatique
    • URL: <Publish URL> (The URL when you published the ATOM feed that contains the VSIX file.)

After the extension gallery has been added, developers can install the Visual Studio extension from the extensions manager of Visual Studio:

  • Click on the Extensions/Manage Extensions menu.
  • Select the Online/P.O.S Informatique gallery.
  • Download and install the P.O.S Informatique Visual Studio Templates.

About

Visual Studio code templates for P.O.S Informatique and also for its customers or project partners.

Resources

License

Stars

Watchers

Forks

Packages

No packages published