fix signing migration

This commit is contained in:
Bryan Thornbury 2016-10-04 16:06:45 -07:00
parent 851ed78605
commit 46b16d2de0
6 changed files with 47 additions and 3 deletions

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

Binary file not shown.

View file

@ -0,0 +1,26 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"keyFile": "./key.snk"
},
"dependencies": {
"Microsoft.NETCore.App": "1.0.1"
},
"frameworks": {
"netcoreapp1.0": {}
},
"runtimes": {
"win7-x64": {},
"win7-x86": {},
"osx.10.10-x64": {},
"osx.10.11-x64": {},
"ubuntu.14.04-x64": {},
"ubuntu.16.04-x64": {},
"centos.7-x64": {},
"rhel.7.2-x64": {},
"debian.8-x64": {},
"fedora.23-x64": {},
"opensuse.13.2-x64": {}
}
}

View file

@ -26,7 +26,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
private AddPropertyTransform<CommonCompilerOptions>[] KeyFileTransforms private AddPropertyTransform<CommonCompilerOptions>[] KeyFileTransforms
=> new [] => new []
{ {
new AddPropertyTransform<CommonCompilerOptions>("KeyFile", new AddPropertyTransform<CommonCompilerOptions>("KeyOriginatorFile",
compilerOptions => compilerOptions.KeyFile, compilerOptions => compilerOptions.KeyFile,
compilerOptions => !string.IsNullOrEmpty(compilerOptions.KeyFile)), compilerOptions => !string.IsNullOrEmpty(compilerOptions.KeyFile)),
new AddPropertyTransform<CommonCompilerOptions>("SignAssembly", new AddPropertyTransform<CommonCompilerOptions>("SignAssembly",

View file

@ -249,11 +249,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
} }
}"); }");
mockProj.Properties.Count(p => p.Name == "AssemblyOriginatorKeyFile").Should().Be(1); mockProj.Properties.Count(p => p.Name == "KeyOriginatorFile").Should().Be(1);
mockProj.Properties.First(p => p.Name == "AssemblyOriginatorKeyFile").Value.Should().Be("../keyfile.snk"); mockProj.Properties.First(p => p.Name == "KeyOriginatorFile").Value.Should().Be("../keyfile.snk");
mockProj.Properties.Count(p => p.Name == "SignAssembly").Should().Be(1); mockProj.Properties.Count(p => p.Name == "SignAssembly").Should().Be(1);
mockProj.Properties.First(p => p.Name == "SignAssembly").Value.Should().Be("true"); mockProj.Properties.First(p => p.Name == "SignAssembly").Value.Should().Be("true");
mockProj.Properties.First(p => p.Name == "SignAssembly").Condition.Should().Be(" '$(OS)' == 'Windows_NT' ");
mockProj.Properties.Count(p => p.Name == "PublicSign").Should().Be(1);
mockProj.Properties.First(p => p.Name == "PublicSign").Value.Should().Be("true");
mockProj.Properties.First(p => p.Name == "PublicSign").Condition.Should().Be(" '$(OS)' != 'Windows_NT' ");
} }
[Fact] [Fact]

View file

@ -26,6 +26,7 @@ namespace Microsoft.DotNet.Migration.Tests
// https://github.com/dotnet/sdk/issues/73 [InlineData("TestAppWithLibrary/TestApp", false)] // https://github.com/dotnet/sdk/issues/73 [InlineData("TestAppWithLibrary/TestApp", false)]
[InlineData("TestAppWithRuntimeOptions")] [InlineData("TestAppWithRuntimeOptions")]
[InlineData("TestAppWithContents")] [InlineData("TestAppWithContents")]
[InlineData("TestAppWithSigning")]
public void It_migrates_apps(string projectName) public void It_migrates_apps(string projectName)
{ {
var projectDirectory = TestAssetsManager.CreateTestInstance(projectName, callingMethod: "i").WithLockFiles().Path; var projectDirectory = TestAssetsManager.CreateTestInstance(projectName, callingMethod: "i").WithLockFiles().Path;