Merge pull request #1565 from dotnet/pakrym/messages
Add better messages for run scenarios
This commit is contained in:
commit
6013ee0981
2 changed files with 9 additions and 3 deletions
|
@ -146,8 +146,12 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
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}.");
|
||||
var rids = string.Join(", ", runtimeIdentifiers);
|
||||
throw new InvalidOperationException($"Can not find runtime target for framework '{TargetFramework}' and RID's '{rids}'. " +
|
||||
"Possible causes:" + Environment.NewLine +
|
||||
"1. Project is not restored or restore failed - run `dotnet restore`" + Environment.NewLine +
|
||||
"2. Project is not targeting `runable` framework (`netstandardapp*` or `net*`)"
|
||||
);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,9 @@ namespace Microsoft.DotNet.Tools.Run
|
|||
context = contexts.FirstOrDefault(c => defaultFrameworks.Contains(c.TargetFramework.Framework));
|
||||
if (context == null)
|
||||
{
|
||||
throw new InvalidOperationException($"Couldn't find target to run. Defaults: {string.Join(", ", defaultFrameworks)}");
|
||||
throw new InvalidOperationException($"Couldn't find target to run. Possible causes:" + Environment.NewLine +
|
||||
"1. No project.lock.json file or restore failed - run `dotnet restore`" + Environment.NewLine +
|
||||
$"2. project.lock.json has multiple targets none of which is in default list ({string.Join(", " , defaultFrameworks)})");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue