update project templates for portable app

also fix dotnet run
This commit is contained in:
Andrew Stanton-Nurse 2016-03-15 11:50:14 -07:00
parent 11e218d341
commit cc00d9d839
10 changed files with 95 additions and 45 deletions

View file

@ -84,7 +84,7 @@ namespace Microsoft.DotNet.Tools.Run
{
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)})");
$"2. project.lock.json has multiple targets none of which is in default list ({string.Join(", ", defaultFrameworks)})");
}
}
@ -125,7 +125,8 @@ namespace Microsoft.DotNet.Tools.Run
}
// Now launch the output and give it the results
var outputName = _context.GetOutputPaths(Configuration).RuntimeFiles.Executable;
var outputPaths = _context.GetOutputPaths(Configuration);
var outputName = outputPaths.RuntimeFiles.Executable;
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@ -145,7 +146,18 @@ namespace Microsoft.DotNet.Tools.Run
}
}
result = Command.Create(outputName, _args)
Command command;
if (outputName.EndsWith(FileNameSuffixes.DotNet.DynamicLib, StringComparison.OrdinalIgnoreCase))
{
// The executable is a ".dll", we need to call it through dotnet.exe
command = Command.Create("corehost", Enumerable.Concat(new[] { outputName }, _args));
}
else
{
command = Command.Create(outputName, _args);
}
result = command
.ForwardStdOut()
.ForwardStdErr()
.Execute()
@ -156,7 +168,7 @@ namespace Microsoft.DotNet.Tools.Run
private static int RunInteractive(string scriptName)
{
var command = Command.CreateDotNet($"repl-csi", new [] {scriptName})
var command = Command.CreateDotNet($"repl-csi", new[] { scriptName })
.ForwardStdOut()
.ForwardStdErr();
var result = command.Execute();