Merge pull request #1241 from dotnet/davidfowl/no-temp-folder-for-run

Removed temporary folder for run
This commit is contained in:
David Fowler 2016-02-04 20:04:02 -08:00
commit 5075b8892e
3 changed files with 9 additions and 25 deletions

View file

@ -133,7 +133,7 @@ namespace Microsoft.DotNet.ProjectModel
// This is the check for mono, if we're not on windows and producing outputs for
// the desktop framework then it's an exe
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _framework.IsDesktop())
if (_framework.IsDesktop())
{
extension = FileNameSuffixes.DotNet.Exe;
}

View file

@ -28,7 +28,6 @@ namespace Microsoft.DotNet.Tools.Run
syntax.DefineOption("f|framework", ref runCmd.Framework, "Compile a specific framework");
syntax.DefineOption("c|configuration", ref runCmd.Configuration, "Configuration under which to build");
syntax.DefineOption("t|preserve-temporary", ref runCmd.PreserveTemporary, "Keep the output's temporary directory around");
syntax.DefineOption("p|project", ref runCmd.Project, "The path to the project to run (defaults to the current directory). Can be a path to a project.json or a project directory");
syntax.DefineOption("h|help", ref help, "Help for compile native.");

View file

@ -16,7 +16,6 @@ namespace Microsoft.DotNet.Tools.Run
{
public string Framework = null;
public string Configuration = null;
public bool PreserveTemporary = false;
public string Project = null;
public IReadOnlyList<string> Args = null;
@ -85,23 +84,15 @@ namespace Microsoft.DotNet.Tools.Run
{
CalculateDefaultsForNonAssigned();
// Create a temporary directory under the project root
// REVIEW: MAX_PATH?
var tempDir = Path.Combine(_context.ProjectDirectory, "bin", ".dotnetrun", Guid.NewGuid().ToString("N"));
// Compile to that directory
var result = Build.BuildCommand.Run(new[]
{
$"--output",
$"{tempDir}",
$"--temp-output",
$"{tempDir}",
$"--framework",
$"{_context.TargetFramework}",
$"--configuration",
$"{Configuration}",
$"{_context.ProjectFile.ProjectDirectory}"
});
{
$"--framework",
$"{_context.TargetFramework}",
$"--configuration",
$"{Configuration}",
$"{_context.ProjectFile.ProjectDirectory}"
});
if (result != 0)
{
@ -109,7 +100,7 @@ namespace Microsoft.DotNet.Tools.Run
}
// Now launch the output and give it the results
var outputName = _context.GetOutputPathCalculator(tempDir).GetExecutablePath(Configuration);
var outputName = _context.GetOutputPathCalculator().GetExecutablePath(Configuration);
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
@ -149,12 +140,6 @@ namespace Microsoft.DotNet.Tools.Run
.Execute()
.ExitCode;
// Clean up
if (!PreserveTemporary)
{
Directory.Delete(tempDir, recursive: true);
}
return result;
}