diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props
index fd0179d4c..412fb9ab9 100644
--- a/build/DependencyVersions.props
+++ b/build/DependencyVersions.props
@@ -59,7 +59,9 @@
2.0.1-servicing-25908-02
$(MicrosoftNETCoreAppPackageVersion)
$(MicrosoftNETCoreAppPackageVersion)
-
+
+ 2.1.0-preview1-27617
2.0.3
aspnetcore-store
dev-26623
diff --git a/build/NugetConfigFile.targets b/build/NugetConfigFile.targets
index ef6be9c14..06eb5cf2c 100644
--- a/build/NugetConfigFile.targets
+++ b/build/NugetConfigFile.targets
@@ -21,6 +21,8 @@
+
+
diff --git a/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs b/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs
new file mode 100644
index 000000000..c8dc622c0
--- /dev/null
+++ b/src/Microsoft.DotNet.Configurer/AspNetCertificateSentinel.cs
@@ -0,0 +1,61 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using Microsoft.DotNet.Cli.Utils;
+using Microsoft.Extensions.EnvironmentAbstractions;
+
+namespace Microsoft.DotNet.Configurer
+{
+ public class AspNetCertificateSentinel : IAspNetCertificateSentinel
+ {
+ public static readonly string SENTINEL = $"{Product.Version}.aspNetCertificateSentinel";
+
+ private readonly IFile _file;
+ private readonly IDirectory _directory;
+
+ private string _dotnetUserProfileFolderPath;
+
+ private string SentinelPath => Path.Combine(_dotnetUserProfileFolderPath, SENTINEL);
+
+ public AspNetCertificateSentinel(CliFolderPathCalculator cliFallbackFolderPathCalculator) :
+ this(
+ CliFolderPathCalculator.DotnetUserProfileFolderPath,
+ FileSystemWrapper.Default.File,
+ FileSystemWrapper.Default.Directory)
+ {
+ }
+
+ internal AspNetCertificateSentinel(string dotnetUserProfileFolderPath, IFile file, IDirectory directory)
+ {
+ _file = file;
+ _directory = directory;
+ _dotnetUserProfileFolderPath = dotnetUserProfileFolderPath;
+ }
+
+ public bool Exists()
+ {
+ return _file.Exists(SentinelPath);
+ }
+
+ public void CreateIfNotExists()
+ {
+ if (!Exists())
+ {
+ if (!_directory.Exists(_dotnetUserProfileFolderPath))
+ {
+ _directory.CreateDirectory(_dotnetUserProfileFolderPath);
+ }
+
+ _file.CreateEmptyFile(SentinelPath);
+ }
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+}
diff --git a/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs b/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs
index 29e17f7de..584ae0923 100644
--- a/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs
+++ b/src/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs
@@ -16,6 +16,8 @@ namespace Microsoft.DotNet.Configurer
private INuGetCachePrimer _nugetCachePrimer;
private INuGetCacheSentinel _nugetCacheSentinel;
private IFirstTimeUseNoticeSentinel _firstTimeUseNoticeSentinel;
+ private IAspNetCertificateSentinel _aspNetCertificateSentinel;
+ private IAspNetCoreCertificateGenerator _aspNetCoreCertificateGenerator;
private string _cliFallbackFolderPath;
private readonly IEnvironmentPath _pathAdder;
@@ -23,6 +25,8 @@ namespace Microsoft.DotNet.Configurer
INuGetCachePrimer nugetCachePrimer,
INuGetCacheSentinel nugetCacheSentinel,
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel,
+ IAspNetCertificateSentinel aspNetCertificateSentinel,
+ IAspNetCoreCertificateGenerator aspNetCoreCertificateGenerator,
IEnvironmentProvider environmentProvider,
IReporter reporter,
string cliFallbackFolderPath,
@@ -31,6 +35,8 @@ namespace Microsoft.DotNet.Configurer
_nugetCachePrimer = nugetCachePrimer;
_nugetCacheSentinel = nugetCacheSentinel;
_firstTimeUseNoticeSentinel = firstTimeUseNoticeSentinel;
+ _aspNetCertificateSentinel = aspNetCertificateSentinel;
+ _aspNetCoreCertificateGenerator = aspNetCoreCertificateGenerator;
_environmentProvider = environmentProvider;
_reporter = reporter;
_cliFallbackFolderPath = cliFallbackFolderPath;
@@ -59,6 +65,31 @@ namespace Microsoft.DotNet.Configurer
_nugetCachePrimer.PrimeCache();
}
}
+
+ if(ShouldGenerateAspNetCertificate())
+ {
+ GenerateAspNetCertificate();
+ }
+ }
+
+ private void GenerateAspNetCertificate()
+ {
+ _aspNetCoreCertificateGenerator.GenerateAspNetCoreDevelopmentCertificate();
+
+ _reporter.WriteLine();
+ _reporter.WriteLine(LocalizableStrings.AspNetCertificateInstalled);
+
+ _aspNetCertificateSentinel.CreateIfNotExists();
+ }
+
+ private bool ShouldGenerateAspNetCertificate()
+ {
+ var generateAspNetCertificate =
+ _environmentProvider.GetEnvironmentVariableAsBool("DOTNET_GENERATE_ASPNET_CERTIFICATE", true);
+
+ return ShouldRunFirstRunExperience() &&
+ generateAspNetCertificate &&
+ !_aspNetCertificateSentinel.Exists();
}
private void AddPackageExecutablePath()
diff --git a/src/Microsoft.DotNet.Configurer/IAspNetCertificateSentinel.cs b/src/Microsoft.DotNet.Configurer/IAspNetCertificateSentinel.cs
new file mode 100644
index 000000000..5a422a1f7
--- /dev/null
+++ b/src/Microsoft.DotNet.Configurer/IAspNetCertificateSentinel.cs
@@ -0,0 +1,12 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Microsoft.DotNet.Configurer
+{
+ public interface IAspNetCertificateSentinel
+ {
+ bool Exists();
+
+ void CreateIfNotExists();
+ }
+}
diff --git a/src/Microsoft.DotNet.Configurer/IAspNetCoreCertificateGenerator.cs b/src/Microsoft.DotNet.Configurer/IAspNetCoreCertificateGenerator.cs
new file mode 100644
index 000000000..e19fc15d6
--- /dev/null
+++ b/src/Microsoft.DotNet.Configurer/IAspNetCoreCertificateGenerator.cs
@@ -0,0 +1,10 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Microsoft.DotNet.Configurer
+{
+ public interface IAspNetCoreCertificateGenerator
+ {
+ void GenerateAspNetCoreDevelopmentCertificate();
+ }
+}
diff --git a/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx b/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx
index 173004d0d..dd7715bb8 100644
--- a/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx
+++ b/src/Microsoft.DotNet.Configurer/LocalizableStrings.resx
@@ -137,7 +137,7 @@ A command is running to populate your local package cache to improve restore spe
Failed to prime the NuGet cache. {0} failed with: {1}
-
+
Permission denied to modify the '{0}' folder.
Here are some options to fix this error:
@@ -147,4 +147,9 @@ Here are some options to fix this error:
3. Copy the .NET Core SDK to a non-protected location and use it from there.
-
+
+ ASP.NET Core
+------------
+Installed ASP.NET Core HTTPS development certificate. For more information go to https://go.microsoft.com/fwlink/?linkid=84805
+
+
\ No newline at end of file
diff --git a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf
index 2721a3a76..7a19f721a 100644
--- a/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf
+++ b/src/Microsoft.DotNet.Configurer/xlf/LocalizableStrings.cs.xlf
@@ -58,6 +58,15 @@ Tuto chybu můžete opravit pomocí některé z těchto možností:
+
+
+ ASP.NET Core
+------------
+Installed ASP.NET Core HTTPS development certificate. For more information go to https://go.microsoft.com/fwlink/?linkid=84805
+
+