diff --git a/NuGet.Config b/NuGet.Config index 347ae77b5..639e51ca7 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,8 +3,8 @@ + - diff --git a/ext/CLRHost/win7-x64/CoreConsole.exe b/ext/CLRHost/win7-x64/CoreConsole.exe new file mode 100644 index 000000000..421805d95 Binary files /dev/null and b/ext/CLRHost/win7-x64/CoreConsole.exe differ diff --git a/ext/CLRHost/win7-x64/CoreRun.exe b/ext/CLRHost/win7-x64/CoreRun.exe new file mode 100644 index 000000000..4577bc510 Binary files /dev/null and b/ext/CLRHost/win7-x64/CoreRun.exe differ diff --git a/scripts/bootstrap.cmd b/scripts/bootstrap.cmd index 617eb3fe3..a87b8a1ba 100644 --- a/scripts/bootstrap.cmd +++ b/scripts/bootstrap.cmd @@ -13,6 +13,9 @@ popd set STAGE0_DIR=%REPOROOT%\artifacts\stage0 set STAGE1_DIR=%REPOROOT%\artifacts\stage1 set STAGE2_DIR=%REPOROOT%\artifacts\stage2 +set RID=win7-x64 +set OUTPUT_ROOT=%REPOROOT%\artifacts\%RID% +set DOTNET_CLR_HOSTS_PATH=%REPOROOT%\ext\CLRHost\%RID% where dnvm >nul 2>nul if %errorlevel% == 0 goto have_dnvm @@ -49,15 +52,15 @@ call %~dp0dnvm2 upgrade if errorlevel 1 goto fail echo Building stage1 dotnet.exe ... -dotnet --framework dnxcore50 --runtime win7-x64 --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli" +dotnet --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli" if errorlevel 1 goto fail echo Building stage1 dotnet-compile.exe ... -dotnet --framework dnxcore50 --runtime win7-x64 --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler" +dotnet --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler" if errorlevel 1 goto fail echo Building stage1 dotnet-publish.exe ... -dotnet --framework dnxcore50 --runtime win7-x64 --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish" +dotnet --framework dnxcore50 --runtime %RID% --output "%STAGE1_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish" if errorlevel 1 goto fail echo Re-building dotnet tools with the bootstrapped version @@ -66,20 +69,19 @@ set PATH=%STAGE1_DIR%;%PATH% if exist %STAGE2_DIR% rd /s /q %STAGE2_DIR% -REM This works around the coreconsole bug where the path to the exe can't be found -pushd -cd %STAGE1_DIR% +REM No longer need our special CoreConsole +set DOTNET_CLR_HOSTS_PATH= echo Building stage2 dotnet.exe ... -dotnet publish --framework dnxcore50 --runtime win7-x64 --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli" +dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli" if errorlevel 1 goto fail echo Building stage2 dotnet-compile.exe ... -dotnet publish --framework dnxcore50 --runtime win7-x64 --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler" +dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler" if errorlevel 1 goto fail echo Building stage2 dotnet-publish.exe ... -dotnet publish --framework dnxcore50 --runtime win7-x64 --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish" +dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish" if errorlevel 1 goto fail echo Bootstrapped dotnet to %STAGE2_DIR% diff --git a/src/Microsoft.DotNet.Cli.Utils/Constants.cs b/src/Microsoft.DotNet.Cli.Utils/Constants.cs index 88cae2cf7..f7ff6d8ce 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Constants.cs +++ b/src/Microsoft.DotNet.Cli.Utils/Constants.cs @@ -12,5 +12,7 @@ namespace Microsoft.DotNet.Cli.Utils public static readonly string CoreConsoleName = "coreconsole" + ExeSuffix; public static readonly string DefaultConfiguration = "Debug"; public static readonly string BinDirectoryName = "bin"; + + public static readonly string HostsPathEnvironmentVariable = "DOTNET_CLR_HOSTS_PATH"; } } diff --git a/src/Microsoft.DotNet.Cli/project.json b/src/Microsoft.DotNet.Cli/project.json index 0f310831a..5c2fe17a3 100644 --- a/src/Microsoft.DotNet.Cli/project.json +++ b/src/Microsoft.DotNet.Cli/project.json @@ -7,7 +7,6 @@ "dotnet": "Microsoft.DotNet.Cli" }, "dependencies": { - "Microsoft.NETCore.ConsoleHost": "1.0.0-*", "Microsoft.NETCore.Runtime": "1.0.1-*", "System.Console": "4.0.0-*", diff --git a/src/Microsoft.DotNet.Tools.Compiler/Program.cs b/src/Microsoft.DotNet.Tools.Compiler/Program.cs index 8cb561e4e..3086b70b7 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler/Program.cs @@ -151,9 +151,13 @@ namespace Microsoft.DotNet.Tools.Compiler private static Command RunCsc(string cscArgs) { - // Hack -- if we find csc + corerun in the app directory we should - // use that, otherwise just try to find csc on the PATH - var corerun = Path.Combine(AppContext.BaseDirectory, "CoreRun.exe"); + // Locate CoreRun + string hostRoot = Environment.GetEnvironmentVariable(Constants.HostsPathEnvironmentVariable); + if(string.IsNullOrEmpty(hostRoot)) + { + hostRoot = AppContext.BaseDirectory; + } + var corerun = Path.Combine(hostRoot, "CoreRun.exe"); var cscExe = Path.Combine(AppContext.BaseDirectory, "csc.exe"); return File.Exists(corerun) && File.Exists(cscExe) ? Command.Create(corerun, $@"""{cscExe}"" {cscArgs}") diff --git a/src/Microsoft.DotNet.Tools.Compiler/project.json b/src/Microsoft.DotNet.Tools.Compiler/project.json index 05abb8573..3b1e8584d 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/project.json +++ b/src/Microsoft.DotNet.Tools.Compiler/project.json @@ -7,7 +7,6 @@ "dotnet-compile": "Microsoft.DotNet.Tools.Compiler" }, "dependencies": { - "Microsoft.NETCore.ConsoleHost": "1.0.0-*", "Microsoft.NETCore.TestHost": "1.0.0-*", "Microsoft.NETCore.Runtime": "1.0.1-*", @@ -25,7 +24,7 @@ "type": "build", "version": "1.0.0-*" }, - "Microsoft.Net.Compilers.netcore": "1.1.0-*", + "Microsoft.Net.Compilers.netcore": "1.1.0-*" }, "frameworks": { "dnxcore50": { } diff --git a/src/Microsoft.DotNet.Tools.Publish/Program.cs b/src/Microsoft.DotNet.Tools.Publish/Program.cs index 9d7d9ca7c..e29a49eec 100644 --- a/src/Microsoft.DotNet.Tools.Publish/Program.cs +++ b/src/Microsoft.DotNet.Tools.Publish/Program.cs @@ -116,29 +116,25 @@ namespace Microsoft.DotNet.Tools.Publish // Publishing for windows, TODO(anurse): Publish for Mac/Linux/etc. - // CoreConsole should be there... - var coreConsole = Path.Combine(outputPath, Constants.CoreConsoleName); - if (!File.Exists(coreConsole)) + // Locate CoreConsole + string hostsPath = Environment.GetEnvironmentVariable(Constants.HostsPathEnvironmentVariable); + if(string.IsNullOrEmpty(hostsPath)) { - Reporter.Error.WriteLine($"Unable to find {Constants.CoreConsoleName} at {coreConsole}. You must have an explicit dependency on Microsoft.NETCore.ConsoleHost (for now ;))".Red().Bold()); + hostsPath = AppContext.BaseDirectory; + } + var coreConsole = Path.Combine(hostsPath, Constants.CoreConsoleName); + if(!File.Exists(coreConsole)) + { + Reporter.Error.WriteLine($"Unable to locate CoreConsole.exe in {coreConsole}, use {Constants.HostsPathEnvironmentVariable} to set the path to it.".Red().Bold()); return 1; } - // Allow CoreConsole to be replaced - string overrideCoreConsole = Environment.GetEnvironmentVariable("DOTNET_CORE_CONSOLE_PATH"); - if(!string.IsNullOrEmpty(overrideCoreConsole) && File.Exists(overrideCoreConsole)) - { - Reporter.Output.WriteLine($"Using CoreConsole override: {overrideCoreConsole}"); - File.Copy(overrideCoreConsole, coreConsole, overwrite: true); - } + // TEMPORARILY bring CoreConsole along for the ride on it's own (without renaming) + File.Copy(coreConsole, Path.Combine(outputPath, Constants.CoreConsoleName), overwrite: true); // Use the 'command' field to generate the name var outputExe = Path.Combine(outputPath, context.ProjectFile.Name + ".exe"); File.Copy(coreConsole, outputExe, overwrite: true); - if (File.Exists(coreConsole)) - { - File.Delete(coreConsole); - } // Check if the a command name is specified, and rename the necessary files if(context.ProjectFile.Commands.Count == 1) diff --git a/src/Microsoft.DotNet.Tools.Publish/project.json b/src/Microsoft.DotNet.Tools.Publish/project.json index fd2795d77..548832c49 100644 --- a/src/Microsoft.DotNet.Tools.Publish/project.json +++ b/src/Microsoft.DotNet.Tools.Publish/project.json @@ -7,9 +7,7 @@ "dotnet-publish": "Microsoft.DotNet.Tools.Publish" }, "dependencies": { - "Microsoft.NETCore.ConsoleHost": "1.0.0-*", "Microsoft.NETCore.Runtime": "1.0.1-*", - "System.Console": "4.0.0-*", "System.Collections": "4.0.11-*", "System.Linq": "4.0.1-*", @@ -23,7 +21,8 @@ "Microsoft.Extensions.CommandLineUtils.Sources": { "type": "build", "version": "1.0.0-*" - } + }, + "System.AppContext": "4.0.1-*" }, "frameworks": { "dnxcore50": { }