Add error message when runtime target is not found

This commit is contained in:
Pavel Krymets 2016-02-19 14:43:30 -08:00
parent f81ba05a7c
commit 69c0375b3f
2 changed files with 8 additions and 2 deletions

View file

@ -143,7 +143,13 @@ namespace Microsoft.DotNet.ProjectModel
public ProjectContext CreateRuntimeContext(IEnumerable<string> runtimeIdentifiers)
{
return Create(ProjectFile.ProjectFilePath, TargetFramework, runtimeIdentifiers);
var context = Create(ProjectFile.ProjectFilePath, TargetFramework, runtimeIdentifiers);
if (context.RuntimeIdentifier == null)
{
var rids = string.Join(",", runtimeIdentifiers);
throw new InvalidOperationException($"Can not find runtime target for framework '{TargetFramework}' and RID's {rids}.");
}
return context;
}
public OutputPaths GetOutputPaths(string configuration, string buidBasePath = null, string outputPath = null)

View file

@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
_contexts = new List<ProjectContext>
{
ProjectContext.Create(_projectJson, new NuGetFramework(string.Empty))
ProjectContext.Create(_projectJson, NuGetFramework.Parse("dnxcore50"))
};
_args = new CompilerCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform");