Removed temporary folder for run
This commit is contained in:
parent
65c026afbf
commit
1e799415cb
3 changed files with 9 additions and 25 deletions
|
@ -133,7 +133,7 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
|
|
||||||
// This is the check for mono, if we're not on windows and producing outputs for
|
// This is the check for mono, if we're not on windows and producing outputs for
|
||||||
// the desktop framework then it's an exe
|
// the desktop framework then it's an exe
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _framework.IsDesktop())
|
if (_framework.IsDesktop())
|
||||||
{
|
{
|
||||||
extension = FileNameSuffixes.DotNet.Exe;
|
extension = FileNameSuffixes.DotNet.Exe;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
|
|
||||||
syntax.DefineOption("f|framework", ref runCmd.Framework, "Compile a specific framework");
|
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("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("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.");
|
syntax.DefineOption("h|help", ref help, "Help for compile native.");
|
||||||
|
|
|
@ -16,7 +16,6 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
{
|
{
|
||||||
public string Framework = null;
|
public string Framework = null;
|
||||||
public string Configuration = null;
|
public string Configuration = null;
|
||||||
public bool PreserveTemporary = false;
|
|
||||||
public string Project = null;
|
public string Project = null;
|
||||||
public IReadOnlyList<string> Args = null;
|
public IReadOnlyList<string> Args = null;
|
||||||
|
|
||||||
|
@ -85,23 +84,15 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
{
|
{
|
||||||
CalculateDefaultsForNonAssigned();
|
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
|
// Compile to that directory
|
||||||
var result = Build.BuildCommand.Run(new[]
|
var result = Build.BuildCommand.Run(new[]
|
||||||
{
|
{
|
||||||
$"--output",
|
$"--framework",
|
||||||
$"{tempDir}",
|
$"{_context.TargetFramework}",
|
||||||
$"--temp-output",
|
$"--configuration",
|
||||||
$"{tempDir}",
|
$"{Configuration}",
|
||||||
$"--framework",
|
$"{_context.ProjectFile.ProjectDirectory}"
|
||||||
$"{_context.TargetFramework}",
|
});
|
||||||
$"--configuration",
|
|
||||||
$"{Configuration}",
|
|
||||||
$"{_context.ProjectFile.ProjectDirectory}"
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +100,7 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now launch the output and give it the results
|
// 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))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
|
@ -149,12 +140,6 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
.Execute()
|
.Execute()
|
||||||
.ExitCode;
|
.ExitCode;
|
||||||
|
|
||||||
// Clean up
|
|
||||||
if (!PreserveTemporary)
|
|
||||||
{
|
|
||||||
Directory.Delete(tempDir, recursive: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue