Merge pull request #1500 from dotnet/pakrym/no-runtime-error

Add error message when runtime target is not found
This commit is contained in:
Pavel Krymets 2016-02-22 16:13:11 -08:00
commit fcc384b175
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");