diff --git a/TestAssets/TestProjects/TestAppWithSigning/Program.cs b/TestAssets/TestProjects/TestAppWithSigning/Program.cs new file mode 100644 index 000000000..51233cffa --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithSigning/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApplication +{ + public class Program + { + public static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/TestAssets/TestProjects/TestAppWithSigning/key.snk b/TestAssets/TestProjects/TestAppWithSigning/key.snk new file mode 100644 index 000000000..fe413a523 Binary files /dev/null and b/TestAssets/TestProjects/TestAppWithSigning/key.snk differ diff --git a/TestAssets/TestProjects/TestAppWithSigning/project.json b/TestAssets/TestProjects/TestAppWithSigning/project.json new file mode 100644 index 000000000..d91e22497 --- /dev/null +++ b/TestAssets/TestProjects/TestAppWithSigning/project.json @@ -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": {} + } +} diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs index e7f64d4f1..dfd0d0f2a 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Rules/MigrateBuildOptionsRule.cs @@ -26,7 +26,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules private AddPropertyTransform[] KeyFileTransforms => new [] { - new AddPropertyTransform("KeyFile", + new AddPropertyTransform("KeyOriginatorFile", compilerOptions => compilerOptions.KeyFile, compilerOptions => !string.IsNullOrEmpty(compilerOptions.KeyFile)), new AddPropertyTransform("SignAssembly", diff --git a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs index 8eb2d353f..cca5d0894 100644 --- a/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs +++ b/test/Microsoft.DotNet.ProjectJsonMigration.Tests/Rules/GivenThatIWantToMigrateBuildOptions.cs @@ -249,11 +249,16 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests } }"); - mockProj.Properties.Count(p => p.Name == "AssemblyOriginatorKeyFile").Should().Be(1); - mockProj.Properties.First(p => p.Name == "AssemblyOriginatorKeyFile").Value.Should().Be("../keyfile.snk"); + mockProj.Properties.Count(p => p.Name == "KeyOriginatorFile").Should().Be(1); + mockProj.Properties.First(p => p.Name == "KeyOriginatorFile").Value.Should().Be("../keyfile.snk"); 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").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] diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 655919ac5..2cc0d5a1d 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -26,6 +26,7 @@ namespace Microsoft.DotNet.Migration.Tests // https://github.com/dotnet/sdk/issues/73 [InlineData("TestAppWithLibrary/TestApp", false)] [InlineData("TestAppWithRuntimeOptions")] [InlineData("TestAppWithContents")] + [InlineData("TestAppWithSigning")] public void It_migrates_apps(string projectName) { var projectDirectory = TestAssetsManager.CreateTestInstance(projectName, callingMethod: "i").WithLockFiles().Path;