Removing DotnetHostPath and setting CscToolExe to determine which script to use to run csc.exe using dotnet. Need to add the script counterpart for windows still. Doing that next.

This commit is contained in:
Livar Cunha 2016-09-21 15:24:54 -07:00
parent 85d6f3ccce
commit 4019fdca16
4 changed files with 33 additions and 8 deletions

View file

@ -32,20 +32,21 @@ namespace Microsoft.DotNet.Tools.MSBuild
return new Dictionary<string, string>
{
{ "MSBuildExtensionsPath", AppContext.BaseDirectory },
{ "DotnetHostPath", GetHostPath() },
{ "CscToolExe", GetRunCscPath() }
};
}
private static string GetHostPath()
{
return new Muxer().MuxerPath;
}
private static string GetMSBuildExePath()
{
return Path.Combine(
AppContext.BaseDirectory,
s_msbuildExeName);
}
private static string GetRunCscPath()
{
var scriptExtension = RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows ? ".cmd" : ".sh";
return Path.Combine(AppContext.BaseDirectory, $"RunCsc{scriptExtension}");
}
}
}

17
src/redist/RunCsc.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
$DIR/../../dotnet $DIR/csc.exe $@

View file

@ -1,7 +1,13 @@
{
"version": "1.0.0-preview3-*",
"buildOptions": {
"emitEntryPoint": true
"emitEntryPoint": true,
"copyToOutput": {
"include": "RunCsc.sh"
}
},
"publishOptions": {
"include": "RunCsc.sh"
},
"dependencies": {
"Microsoft.NETCore.App": {
@ -19,6 +25,7 @@
"Microsoft.Build.Utilities.Core": "0.1.0-preview-00039-160922",
"Microsoft.Build.Targets": "0.1.0-preview-00039-160922",
"Microsoft.Build": "0.1.0-preview-00039-160922",
"Microsoft.CodeAnalysis.Build.Tasks": "2.0.0-beta6-60920-07",
"System.Runtime.Serialization.Xml": "4.1.1",
"NuGet.Build.Tasks": "3.6.0-beta.1.msbuild.9",
"Microsoft.TestPlatform.CLI": "15.0.0-preview-20160915-01"

View file

@ -14,7 +14,7 @@
"Microsoft.CodeAnalysis.Build.Tasks": "2.0.0-beta6-60920-07",
"Microsoft.Cci": "4.0.0-rc3-24128-00",
"Microsoft.Composition": "1.0.30",
"Microsoft.NuGet.Build.Tasks": "1.0.0-alpha-000002"
"Microsoft.NuGet.Build.Tasks": "1.0.0-alpha-000003"
},
"frameworks": {
"netcoreapp1.0": {