diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Publish.targets b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Publish.targets index 6955c30f351e..b79f3ccdd6ba 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Publish.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Publish.targets @@ -579,7 +579,7 @@ Copyright (c) .NET Foundation. All rights reserved. - $(AssemblyName)%(Extension) + $(AssemblyName)$(_NativeExecutableExtension) diff --git a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs index 6829a879fddf..3e56bec38970 100644 --- a/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs +++ b/test/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs @@ -102,6 +102,45 @@ public void It_publishes_self_contained_apps_to_the_publish_folder_and_the_app_s .HaveStdOutContaining("Hello World!"); } + [Fact] + public void Publish_self_contained_app_with_dot_in_the_name() + { + var targetFramework = "netcoreapp2.0"; + var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); + + TestProject testProject = new TestProject() + { + Name = "Hello.World", + IsSdkProject = true, + TargetFrameworks = targetFramework, + RuntimeIdentifier = rid, + IsExe = true, + }; + + + testProject.SourceFiles["Program.cs"] = @" +using System; +public static class Program +{ + public static void Main() + { + Console.WriteLine(""Hello from a netcoreapp2.0.!""); + } +} +"; + var testProjectInstance = _testAssetsManager.CreateTestProject(testProject); + + testProjectInstance.Restore(Log, testProject.Name); + var publishCommand = new PublishCommand(Log, Path.Combine(testProjectInstance.TestRoot, testProject.Name)); + publishCommand.Execute().Should().Pass(); + + var publishDirectory = publishCommand.GetOutputDirectory( + targetFramework: targetFramework, + runtimeIdentifier: rid); + + publishDirectory.Should().HaveFile($"Hello.World{Constants.ExeSuffix}"); + } + //Note: Pre Netcoreapp2.0 stanalone activation uses renamed dotnet.exe // While Post 2.0 we are shifting to using apphost.exe, so both publish needs to be validated [Fact] @@ -110,7 +149,6 @@ public void Publish_standalone_post_netcoreapp2_app_and_it_should_run() var targetFramework = "netcoreapp2.0"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); - TestProject testProject = new TestProject() { Name = "Hello",