Support overriding strong naming key path with environment variable.

This commit is contained in:
Cesar Blum Silveira 2015-12-10 16:26:05 -08:00
parent 93158dc1be
commit fb461c27bf
2 changed files with 9 additions and 1 deletions

View file

@ -6,5 +6,6 @@ namespace Microsoft.DotNet.ProjectModel
public class EnvironmentNames
{
public static readonly string PackagesCache = "NUGET_PACKAGES";
public static readonly string StrongNameKeyFile = "DOTNET_BUILD_STRONG_NAME_KEYFILE";
}
}

View file

@ -293,7 +293,14 @@ namespace Microsoft.DotNet.Tools.Compiler
var compilationOptions = context.ProjectFile.GetCompilerOptions(context.TargetFramework, configuration);
if (!string.IsNullOrEmpty(compilationOptions.KeyFile))
// Path to strong naming key in environment variable overrides path in project.json
var environmentKeyFile = Environment.GetEnvironmentVariable(EnvironmentNames.StrongNameKeyFile);
if (!string.IsNullOrWhiteSpace(environmentKeyFile))
{
compilationOptions.KeyFile = environmentKeyFile;
}
else if (!string.IsNullOrWhiteSpace(compilationOptions.KeyFile))
{
// Resolve full path to key file
compilationOptions.KeyFile = Path.GetFullPath(Path.Combine(context.ProjectFile.ProjectDirectory, compilationOptions.KeyFile));