提交 2d36e419 编写于 作者: A Andy Gocke 提交者: GitHub

Create a NETCore-targeted Compilers NuGet package (#19190)

Creates a new package, Microsoft.NETCore.Compilers, which contains
CoreCLR-compatible versions of csc and vbc compiled against the
netcoreapp1.1 shared framework. This NuGet package can be referenced
by any C# or VB MSBuild project as long as the `dotnet` command line
tools and the netcoreapp1.1 framework is installed.
上级 8cda7de6
......@@ -12,6 +12,8 @@
# files must be hard-coded to be cloned with LF
src/Compilers/CSharp/CscCore/csc text eol=lf
src/Compilers/VisualBasic/VbcCore/vbc text eol=lf
build/NuGetAdditionalFiles/RunCsc text eol=lf
build/NuGetAdditionalFiles/RunVbc text eol=lf
###############################################################################
# Set default behavior for command prompt diff.
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="14.0" DefaultTargets="Build" InitialTargets="MakeCompilerScriptsExecutable" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Always use the local build task, even if we just shell out to an exe in case there are
new properties in the local build task. -->
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Csc"
AssemblyFile="$(MSBuildThisFileDirectory)..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll" />
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Vbc"
AssemblyFile="$(MSBuildThisFileDirectory)..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll" />
<PropertyGroup>
<CSharpCoreTargetsPath>$(MSBuildThisFileDirectory)..\tools\Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
<BasicCoreTargetsPath>$(MSBuildThisFileDirectory)..\tools\Microsoft.VisualBasic.Core.targets</BasicCoreTargetsPath>
</PropertyGroup>
<!-- Set ToolPath/Exe to direct to the exes in this package -->
<PropertyGroup>
<!-- Compiler server is not currently supported on CoreCLR -->
<UseSharedCompilation>false</UseSharedCompilation>
<CscToolPath>$(MSBuildThisFileDirectory)..\tools\bincore</CscToolPath>
<CscToolExe Condition="'$(OS)' == 'Windows_NT'">RunCsc.cmd</CscToolExe>
<CscToolExe Condition="'$(OS)' != 'Windows_NT'">RunCsc</CscToolExe>
<VbcToolPath>$(MSBuildThisFileDirectory)..\tools\bincore</VbcToolPath>
<VbcToolExe Condition="'$(OS)' == 'Windows_NT'">RunVbc.cmd</VbcToolExe>
<VbcToolExe Condition="'$(OS)' != 'Windows_NT'">RunVbc</VbcToolExe>
</PropertyGroup>
<!-- If packaged on Windows, the RunCsc and RunVbc scripts may not be marked
executable. If we're not running on Windows, mark them as such, just in case -->
<Target Name="MakeCompilerScriptsExecutable"
Condition="'$(BuildingProject)' == 'true' AND '$(OS)' != 'Windows_NT'"
BeforeTargets="CoreCompile">
<Exec Command="chmod +x &quot;$(CscToolPath)/$(CscToolExe)&quot; &quot;$(VbcToolPath)/$(VbcToolExe)&quot;" />
</Target>
</Project>
#!/bin/sh
THISDIR=$(dirname $0)
dotnet $THISDIR/csc.dll "$@"
echo off
dotnet %~dp0\csc.dll %*
#!/bin/sh
THISDIR=$(dirname $0)
dotnet $THISDIR/vbc.dll "$@"
echo off
dotnet %~dp0\vbc.dll %*
......@@ -5,7 +5,6 @@
<PropertyGroup>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifier>x64</RuntimeIdentifier>
<ProjectGuid>{8CE3A581-2969-4864-A803-013E9D977C3A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.VisualBasic.CommandLine</RootNamespace>
......
......@@ -76,8 +76,6 @@ var IsCoreBuild = File.Exists(Path.Combine(ToolsetPath, "corerun"));
#endregion
var NuGetAdditionalFilesPath = Path.Combine(SolutionRoot, "build/NuGetAdditionalFiles");
var ThirdPartyNoticesPath = Path.Combine(NuGetAdditionalFilesPath, "ThirdPartyNotices.rtf");
var NetCompilersPropsPath = Path.Combine(NuGetAdditionalFilesPath, "Microsoft.Net.Compilers.props");
string[] RedistPackageNames = {
"Microsoft.CodeAnalysis",
......@@ -111,6 +109,7 @@ string[] NonRedistPackageNames = {
"Microsoft.Net.Compilers",
"Microsoft.Net.Compilers.netcore",
"Microsoft.Net.CSharp.Interactive.netcore",
"Microsoft.NETCore.Compilers",
"Microsoft.VisualStudio.IntegrationTest.Utilities",
"Microsoft.VisualStudio.LanguageServices.Razor.RemoteClient",
};
......@@ -128,6 +127,7 @@ var PreReleaseOnlyPackages = new HashSet<string>
"Microsoft.CodeAnalysis.VisualBasic.Scripting",
"Microsoft.Net.Compilers.netcore",
"Microsoft.Net.CSharp.Interactive.netcore",
"Microsoft.NETCore.Compilers",
"Microsoft.CodeAnalysis.Remote.Razor.ServiceHub",
"Microsoft.CodeAnalysis.Remote.ServiceHub",
"Microsoft.CodeAnalysis.Remote.Workspaces",
......@@ -204,9 +204,8 @@ int PackFiles(string[] nuspecFiles, string licenseUrl)
{ "authors", Authors },
{ "projectURL", ProjectURL },
{ "tags", Tags },
{ "thirdPartyNoticesPath", ThirdPartyNoticesPath },
{ "netCompilersPropsPath", NetCompilersPropsPath },
{ "emptyDirPath", emptyDir },
{ "additionalFilesPath", NuGetAdditionalFilesPath }
};
foreach (var dependencyVersion in dependencyVersions)
......
......@@ -28,6 +28,6 @@
<tags>$tags$</tags>
</metadata>
<files>
<file src="$thirdPartyNoticesPath$" target="" />
<file src="$additionalFilesPath$/ThirdPartyNotices.rtf" target="" />
</files>
</package>
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Microsoft.NETCore.Compilers</id>
<description>
CoreCLR-compatible versions of the C# and VB compilers for use in MSBuild.
</description>
<language>en-US</language>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<version>$version$</version>
<authors>$authors$</authors>
<licenseUrl>$licenseUrl$</licenseUrl>
<projectUrl>$projectUrl$</projectUrl>
<tags>$tags$</tags>
<serviceable>true</serviceable>
<developmentDependency>true</developmentDependency>
</metadata>
<files>
<file src="$additionalFilesPath$/Microsoft.NETCore.Compilers.props" target="build" />
<!-- Targets and task files -->
<file src="Dlls/MSBuildTask/Microsoft.Build.Tasks.CodeAnalysis.dll" target="tools" />
<file src="Dlls/MSbuildTask/Microsoft.CSharp.Core.targets" target="tools" />
<file src="Dlls/MSbuildTask/Microsoft.VisualBasic.Core.targets" target="tools" />
<!-- Compiler exe files -->
<file src="Dlls/CodeAnalysis/Microsoft.CodeAnalysis.dll" target="tools/bincore" />
<file src="Dlls/CSharpCodeAnalysis/Microsoft.CodeAnalysis.CSharp.dll" target="tools/bincore" />
<file src="Exes/CscCore/publish/csc.dll" target="tools/bincore" />
<file src="Exes/CscCore/publish/csc.deps.json" target="tools/bincore" />
<file src="Exes/CscCore/publish/csc.runtimeconfig.json" target="tools/bincore" />
<file src="$additionalFilesPath$/RunCsc" target="tools/bincore/RunCsc" />
<file src="$additionalFilesPath$/RunCsc.cmd" target="tools/bincore" />
<file src="Dlls/BasicCodeAnalysis/Microsoft.CodeAnalysis.VisualBasic.dll" target="tools/bincore" />
<file src="Exes/VbcCore/publish/vbc.dll" target="tools/bincore" />
<file src="Exes/VbcCore/publish/vbc.deps.json" target="tools/bincore" />
<file src="Exes/VbcCore/publish/vbc.runtimeconfig.json" target="tools/bincore" />
<file src="$additionalFilesPath$/RunVbc" target="tools/bincore/RunVbc" />
<file src="$additionalFilesPath$/RunVbc.cmd" target="tools/bincore" />
<!-- References that are either not in the target framework or are a higher version -->
<file src="Exes\CscCore\publish\System.*.dll" target="tools\bincore" />
<file src="Exes\CscCore\publish\runtimes\**" target="tools\bincore\runtimes" />
</files>
</package>
......@@ -18,8 +18,8 @@
<developmentDependency>true</developmentDependency>
</metadata>
<files>
<file src="$netCompilersPropsPath$" target="build\Microsoft.Net.Compilers.props" />
<file src="$thirdPartyNoticesPath$" target="" />
<file src="$additionalFilesPath$/Microsoft.Net.Compilers.props" target="build" />
<file src="$additionalFilesPath$/ThirdPartyNotices.rtf" target="" />
<!-- The Roslyn built binaries must be taken from these locations because this is
the location where signing occurs -->
......
......@@ -4,6 +4,14 @@
<Import Project="..\..\build\Targets\Settings.props" />
<Target Name="Build">
<MSBuild BuildInParallel="true"
Projects="$(MSBuildThisFileDirectory)..\Compilers\CSharp\CscCore\CscCore.csproj"
Targets="Publish" />
<MSBuild BuildInParallel="true"
Projects="$(MSBuildThisFileDirectory)..\Compilers\VisualBasic\VbcCore\VbcCore.csproj"
Targets="Publish" />
<!-- NuGetPerBuildPreReleaseVersion -->
<Exec Command="$(OutputPath)Exes\csi\csi.exe $(MSBuildThisFileDirectory)BuildNuGets.csx $(OutputPath) $(NuGetPerBuildPreReleaseVersion) $(OutputPath)NuGet\PerBuildPreRelease" Condition="'$(NuGetPerBuildPreReleaseVersion)' != ''" />
......
use vs
package name=PortableFacades
version=1.3.0.0
version=1.4.0.0
folder InstallDir:\Common7\IDE\PrivateAssemblies
file source="$(NuGetPackageRoot)\System.AppContext\4.3.0\lib\net46\System.AppContext.dll" vs.file.ngen=yes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册