aspnetcore/src/Microsoft.AspNetCore.Certif.../README.md

1.2 KiB

Microsoft.AspNetCore.CertificateGeneration.Task

Microsoft.AspNetCore.CertificateGeneration.Task is an MSBuild task to generate SSL certificates for use in ASP.NET Core for development purposes.

How To Install

Install Microsoft.AspNetCore.CertificateGeneration.Task as a PackageReference to your project.

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.CertificateGeneration.Task" Version="2.0.0" />
  </ItemGroup>

How To Use

The command must be executed in the directory that contains the project with the reference to the package.

Usage: dotnet msbuild /t:GenerateSSLCertificate [/p:ForceGenerateSSLCertificate=true]

Testing scenarios

On a machine without an SSL certificate generated by this task. Create a netcoreapp2.0 mvc application using

dotnet new mvc

Then try to run the app using:

dotnet run

When the application fails to run due to a missing SSL certificate. Run:

dotnet msbuild /t:GenerateSSLCertificate

Run the application again using:

dotnet run

The application should run successfully. You will still have to trust the certificate as a separate step.