diff --git a/src/Microsoft.DotNet.Compiler.Common/Executable.cs b/src/Microsoft.DotNet.Compiler.Common/Executable.cs index 33d3a887f..eab60e6ef 100644 --- a/src/Microsoft.DotNet.Compiler.Common/Executable.cs +++ b/src/Microsoft.DotNet.Compiler.Common/Executable.cs @@ -32,6 +32,11 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common public void MakeCompilationOutputRunnable() { + if (string.IsNullOrEmpty(_context.RuntimeIdentifier)) + { + throw new InvalidOperationException($"Can not make output runnable for framework {_context.TargetFramework}, because it doesn't have runtime target"); + } + var outputPath = _outputPaths.RuntimeOutputPath; CopyContentFiles(outputPath); diff --git a/test/dotnet-build.Tests/BuildOutputTests.cs b/test/dotnet-build.Tests/BuildOutputTests.cs index 778758180..dd6414771 100644 --- a/test/dotnet-build.Tests/BuildOutputTests.cs +++ b/test/dotnet-build.Tests/BuildOutputTests.cs @@ -68,10 +68,10 @@ namespace Microsoft.DotNet.Tools.Builder.Tests [Theory] // global.json exists - [InlineData(true, null, null, "src/TestLibrary/bin/debug/{fw}", "src/TestApp/bin/debug/{fw}", "src/TestApp/bin/debug/{fw}/{rid}")] - [InlineData(true, "out", null, "src/TestLibrary/bin/debug/{fw}", "src/TestApp/bin/debug/{fw}", "out")] - [InlineData(true, null, "build", "build/src/TestLibrary/bin/debug/{fw}", "build/src/TestApp/bin/debug/{fw}", "build/src/TestApp/bin/debug/{fw}/{rid}")] - [InlineData(true, "out", "build", "build/src/TestLibrary/bin/debug/{fw}", "build/src/TestApp/bin/debug/{fw}", "out")] + [InlineData(true, null, null, "src/TestLibrary/bin/Debug/{fw}", "src/TestApp/bin/Debug/{fw}", "src/TestApp/bin/Debug/{fw}/{rid}")] + [InlineData(true, "out", null, "src/TestLibrary/bin/Debug/{fw}", "src/TestApp/bin/Debug/{fw}", "out")] + [InlineData(true, null, "build", "build/src/TestLibrary/bin/Debug/{fw}", "build/src/TestApp/bin/Debug/{fw}", "build/src/TestApp/bin/Debug/{fw}/{rid}")] + [InlineData(true, "out", "build", "build/src/TestLibrary/bin/Debug/{fw}", "build/src/TestApp/bin/Debug/{fw}", "out")] //no global.json //[InlineData(false, null, null, "src/TestLibrary/bin/debug/{fw}", "src/TestApp/bin/debug/{fw}", "src/TestApp/bin/debug/{fw}/{rid}")] //[InlineData(false, "out", null, "src/TestLibrary/bin/debug/{fw}", "src/TestApp/bin/debug/{fw}", "out")]