Merge pull request #43 from tmat/21

RepoToolset v21
This commit is contained in:
Tomáš Matoušek 2017-07-14 16:46:43 -07:00 коммит произвёл GitHub
Родитель 204d3eb802 5280e6f859
Коммит 77e5b881c7
37 изменённых файлов: 966 добавлений и 340 удалений

Просмотреть файл

@ -8,7 +8,7 @@
</dependencies>
<language>en-US</language>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<version>1.0.0-alpha20</version>
<version>1.0.0-alpha21</version>
<authors>Microsoft</authors>
<licenseUrl>http://go.microsoft.com/fwlink/?LinkId=529443</licenseUrl>
<tags>Repository Toolset MSBuild SDK</tags>

Просмотреть файл

@ -1,26 +1,29 @@
<Project DefaultTargets="Execute">
<!-- 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 DefaultTargets="Execute">
<!--
Required parameters:
SolutionPath Path to the solution to build
Optional parameters:
Configuration Build configuration: "Debug", "Release", etc.
CIBuild "true" when building on CI server
Restore "true" to restore toolset and solution
Build "true" to build solution
Rebuild "true" to rebuild solution
Deploy "true" to deploy assets (e.g. VSIXes)
Test "true" to run tests
IntegrationTest "true" to run integration tests
Sign "true" to sign built binaries
Pack "true" to build NuGet packages
Properties List of properties to pass to each build phase ("Name=Value;Name=Value;...")
-->
<!--
Import Directory.Build.props file next to or above the solution file.
We expect this file to define dependency versions, NuGetPackageRoot and SignToolDataPath.
-->
<!--
Import Directory.Build.props file next to or above the solution file.
We expect this file to define dependency versions, NuGetPackageRoot and SignToolDataPath.
-->
<PropertyGroup>
<_DirectoryBuildPropsFile>Directory.Build.props</_DirectoryBuildPropsFile>
<_DirectoryBuildPropsBasePath>$([MSBuild]::GetDirectoryNameOfFileAbove('$(SolutionPath)', '$(_DirectoryBuildPropsFile)'))</_DirectoryBuildPropsBasePath>
@ -29,37 +32,43 @@
<Import Project="$(DirectoryBuildPropsPath)"/>
<Import Project="RepoLayout.props"/>
<Import Project="DefaultVersions.props"/>
<Target Name="Execute">
<ItemGroup>
<_DotNetDlls Include="$(DotNetRoot)sdk\**\dotnet.dll" />
</ItemGroup>
<!-- Copy XUnitLogger.dll to $(DotNetRoot)sdk\*\Extensions.
It's currently not possible to pass the logger path to dotnet test directly,
It loads extensions from dotnet sdk Extensions folder, so we need to copy it there on restore.
See https://github.com/Microsoft/vstest/issues/522 -->
<Copy DestinationFiles="@(_DotNetDlls->'$(DotNetRoot)sdk\%(RecursiveDir)Extensions\XUnitLogger.dll')"
SkipUnchangedFiles="true"
SourceFiles="@(_DotNetDlls->'$(NuGetPackageRoot)RoslynTools.Microsoft.XUnitLogger\$(RoslynToolsMicrosoftXUnitLoggerVersion)\lib\netstandard1.5\XUnitLogger.dll')"
Condition="'$(Restore)' == 'true'" />
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Props>$(Properties);Configuration=$(Configuration);CIBuild=$(CIBuild)</Props>
<Props>$(Properties);Configuration=$(Configuration);CIBuild=$(CIBuild);__DeployProjectOutput=$(Deploy)</Props>
</PropertyGroup>
<ItemGroup>
<PreSignTargets Include="Restore" Condition="'$(Restore)' == 'true'" />
<PreSignTargets Include="Rebuild" Condition"'$(Rebuild)' == 'true'" />>
<PreSignTargets Include="Build" Condition="'$(Build)' == 'true' AND '$(Rebuild)' != 'true'" />
<PreSignTargets Include="Rebuild" Condition="'$(Rebuild)' == 'true'" />
<PreSignTargets Include="Build" Condition="'$(Build)' == 'true' and '$(Rebuild)' != 'true'" />
<!-- Deploy target is set up to chain after Build so that F5 in VS works. -->
<PreSignTargets Include="Test" Condition="'$(Test)' == 'true'" />
<PreSignTargets Include="IntegrationTest" Condition="'$(IntegrationTest)' == 'true'" />
</ItemGroup>
<!-- Note: msbuild caches the metaproject for the solution (see https://github.com/Microsoft/msbuild/issues/1695)
We invalidate the cache by changing the value of __BuildPhase property.
<ItemGroup>
<RestoreToolsProp Include="BaseIntermediateOutputPath=$(ArtifactsToolsetDir)Common"/>
<RestoreToolsProp Include="ExcludeRestorePackageImports=true"/>
<RestoreToolsProp Include="UsingToolVSSDK=$(UsingToolVSSDK)"/>
<RestoreToolsProp Include="RoslynToolsMicrosoftSignToolVersion=$(RoslynToolsMicrosoftSignToolVersion)"/>
<RestoreToolsProp Include="MicroBuildCoreVersion=$(MicroBuildCoreVersion)"/>
<RestoreToolsProp Include="MicroBuildPluginsSwixBuildVersion=$(MicroBuildPluginsSwixBuildVersion)"/>
<RestoreToolsProp Include="MicrosoftNetCompilersVersion=$(MicrosoftNetCompilersVersion)"/>
</ItemGroup>
<!--
Note: msbuild caches the metaproject for the solution (see https://github.com/Microsoft/msbuild/issues/1695)
We invalidate the cache by changing the value of __BuildPhase property.
-->
<MSBuild Projects="Tools.proj"
Targets="Restore"
Properties="@(RestoreToolsProp)"
Condition="'$(Restore)' == 'true'"/>
<MSBuild Projects="$(SolutionPath)"
Properties="$(Props);__BuildPhase=PreSign"
Targets="@(PreSignTargets)"
@ -72,9 +81,10 @@
BuildInParallel="true"
Condition="'$(Sign)' == 'true'"/>
<!-- It is important to skip the build (NoBuild=true) when creating NuGet packages.
Otherwise, if the output binaries were real-signed in the previous step the Build task
overwrite the signed files with the ones from obj dir.
<!--
It is important to skip the build (NoBuild=true) when creating NuGet packages.
Otherwise, if the output binaries were real-signed in the previous step the Build task
overwrite the signed files with the ones from obj dir.
-->
<MSBuild Projects="$(SolutionPath)"
Properties="$(Props);NoBuild=true;__BuildPhase=PostSign"
@ -82,10 +92,14 @@
BuildInParallel="true"
Condition="'$(Pack)' == 'true'"/>
<MSBuild Projects="VisualStudio.Pack.proj"
<!--
Since multiple projects may contribute to a single insertion component
we need to package them in a separate phase.
-->
<MSBuild Projects="VisualStudio.Insertion.Pack.proj"
Properties="$(Props);DirectoryBuildPropsPath=$(DirectoryBuildPropsPath)"
Targets="Pack"
BuildInParallel="true"
Condition="'$(Pack)' == 'true'"/>
Condition="'$(Pack)' == 'true' and '$(UsingToolVSSDK)' == 'true'"/>
</Target>
</Project>
</Project>

Просмотреть файл

@ -1,26 +0,0 @@
<!-- 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 DefaultTargets="Build" InitialTargets="RestoreToolsetCheck">
<!--
Requires the following properties to be set:
NuGetPackageRoot
MicrosoftNetCompilersVersion
-->
<PropertyGroup>
<ToolsetCompilerPackageDir>$(NuGetPackageRoot)Microsoft.Net.Compilers\$(MicrosoftNetCompilersVersion)\</ToolsetCompilerPackageDir>
<ToolsetCompilerPropsFilePath>$(ToolsetCompilerPackageDir)build\Microsoft.Net.Compilers.props</ToolsetCompilerPropsFilePath>
</PropertyGroup>
<Target Name="RestoreToolsetCheck" Condition="'$(BuildingProject)' == 'true'">
<Error Text="Property not set: MicrosoftNetCompilersVersion"
Condition="'$(MicrosoftNetCompilersVersion)' == ''"/>
<Error Text="Toolset packages have not been restored, run Restore before building"
Condition="!Exists('$(ToolsetCompilerPropsFilePath)')" />
</Target>
<Import Project="$(ToolsetCompilerPropsFilePath)" Condition="Exists('$(ToolsetCompilerPropsFilePath)')" />
</Project>

Просмотреть файл

@ -0,0 +1,30 @@
<!-- 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>
<!--
Sets versions of packages used by the toolset unless they were already specified by the repo.
-->
<PropertyGroup>
<!-- Opt-out features -->
<UsingToolXliff Condition="'$(UsingToolXliff)' == ''">true</UsingToolXliff>
<UsingToolSourceLink Condition="'$(UsingToolSourceLink)' == ''">true</UsingToolSourceLink>
<UsingToolXUnit Condition="'$(UsingToolXUnit)' == ''">true</UsingToolXUnit>
<!-- Opt-in features -->
<UsingToolVSSDK Condition="'$(UsingToolVSSDK)' == ''">false</UsingToolVSSDK>
<UsingToolIbcOptimization Condition="'$(UsingToolIbcOptimization)' == ''">false</UsingToolIbcOptimization>
<!-- Default versions -->
<XliffTasksVersion Condition="'$(XliffTasksVersion)' == ''">0.2.0-beta-000051</XliffTasksVersion>
<SourceLinkCreateCommandLineVersion Condition="'$(SourceLinkCreateCommandLineVersion)' == ''">2.2.0-b491</SourceLinkCreateCommandLineVersion>
<XUnitVersion Condition="'$(XUnitVersion)' == ''">2.3.0-beta3-build3705</XUnitVersion>
<MicrosoftVSSDKBuildToolsVersion Condition="'$(MicrosoftVSSDKBuildToolsVersion)' == ''">15.1.192</MicrosoftVSSDKBuildToolsVersion>
<MicroBuildPluginsSwixBuildVersion Condition="'$(MicroBuildPluginsSwixBuildVersion)' == ''">1.0.147</MicroBuildPluginsSwixBuildVersion>
<MicrosoftDotNetIBCMergeVersion Condition="'$(MicrosoftDotNetIBCMergeVersion)' == ''">4.7.1-alpha-00001</MicrosoftDotNetIBCMergeVersion>
<RoslynToolsMicrosoftSignToolVersion Condition="'$(RoslynToolsMicrosoftSignToolVersion)' == ''">0.3.3-beta</RoslynToolsMicrosoftSignToolVersion>
<MicroBuildCoreVersion Condition="'$(MicroBuildCoreVersion)' == ''">0.2.0</MicroBuildCoreVersion>
<XUnitRunnerVisualStudioVersion Condition="'$(XUnitRunnerVisualStudioVersion)' == ''">2.3.0-beta3-build3705</XUnitRunnerVisualStudioVersion>
<MicrosoftNETTestSdkVersion Condition="'$(MicrosoftNETTestSdkVersion)' == ''">15.3.0-preview-20170628-02</MicrosoftNETTestSdkVersion>
<MicrosoftNetCompilersVersion Condition="'$(MicrosoftNetCompilersVersion)' == ''">2.3.0-beta4-61908-01</MicrosoftNetCompilersVersion>
<RoslynToolsMicrosoftModifyVsixManifestVersion Condition="'$(RoslynToolsMicrosoftModifyVsixManifestVersion)' == ''">0.2.4-beta</RoslynToolsMicrosoftModifyVsixManifestVersion>
</PropertyGroup>
</Project>

Просмотреть файл

@ -10,42 +10,27 @@
</InternalsVisibleTo>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(PublicKey)' != '' and '$(SignAssembly)' == 'True'">
<InternalsVisibleToSuffix>, PublicKey=$(PublicKey)</InternalsVisibleToSuffix>
</PropertyGroup>
<Target Name="PrepareGenerateInternalsVisibleToFile" Condition="'@(InternalsVisibleTo)' != ''">
<ItemGroup>
<_InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1 Condition="'%(InternalsVisibleTo.Key)' != ''">%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.Key)</_Parameter1>
<_Parameter1 Condition="'%(InternalsVisibleTo.Key)' == ''">%(InternalsVisibleTo.Identity), PublicKey=$(PublicKey)</_Parameter1>
</_InternalsVisibleToAttribute>
</ItemGroup>
</Target>
<!-- Dependency on PrepareForBuild is necessary so that we don't accidentally get ordered before it.
We rely on PrepareForBuild to create the IntermediateOutputDirectory if it doesn't exist. -->
<!--
Dependency on PrepareForBuild is necessary so that we don't accidentally get ordered before it.
We rely on PrepareForBuild to create the IntermediateOutputDirectory if it doesn't exist.
-->
<Target Name="GenerateInternalsVisibleToFile"
Inputs="$(MSBuildThisFileFullPath);$(MSBuildProjectFile)"
Outputs="$(GeneratedInternalsVisibleToFile)"
DependsOnTargets="PrepareForBuild"
DependsOnTargets="PrepareGenerateInternalsVisibleToFile;PrepareForBuild"
Condition="'@(InternalsVisibleTo)' != ''"
BeforeTargets="CoreCompile">
<!--
This is a slightly evil trick. What we have is a group of InternalsVisibleTo items which
we need to convert to the items that the WriteCodeFragment expects. They look like this:
<InternalsVisibleTo Include="Foo" />
And need to convert it to:
<InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>Foo</Parameter1>
</InternalsVisibleToAttribute>
One way (although a bit evil) is to use the old CreateItem task. Since we use the well-defined
"Identity" metadata on each of our itemgroups, MSBuild batching will take effect and this task
will be invoked once for each InternalsVisibleTo item.
-->
<CreateItem Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute"
AdditionalMetadata="_Parameter1=%(InternalsVisibleTo.Identity)$(InternalsVisibleToSuffix)"
Condition="'@(InternalsVisibleTo)' != ''">
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
</CreateItem>
<WriteCodeFragment AssemblyAttributes="@(InternalsVisibleToAttribute)"
<WriteCodeFragment AssemblyAttributes="@(_InternalsVisibleToAttribute)"
Language="$(Language)"
OutputFile="$(GeneratedInternalsVisibleToFile)">
<Output TaskParameter="OutputFile" ItemName="Compile" />

Просмотреть файл

@ -2,15 +2,60 @@
#r "System.Xml.Linq"
using System.Xml.Linq;
using System.Globalization;
const int maxDocCommentLength = 256;
string resxFile = Args[0];
string resourceName = Args[1];
string sourceOutputPath = Args[2];
string languageStr = Args[0];
string resxFile = Args[1];
string resourceName = Args[2];
string sourceOutputPath = Args[3];
string namespaceName = Path.GetFileNameWithoutExtension(resourceName);
string className = Path.GetExtension(resourceName).TrimStart('.');
string namespaceName;
string className;
string[] nameParts = resourceName.Split('.');
if (nameParts.Length == 1)
{
namespaceName = null;
className = nameParts[0];
}
else
{
namespaceName = string.Join(".", nameParts, 0, nameParts.Length - 1);
className = nameParts.Last();
}
bool cs = false, vb = false;
switch (languageStr.ToUpperInvariant())
{
case "C#": cs = true; break;
case "VB": vb = true; break;
default: throw new NotSupportedException($"GenerateResxSource doesn't support language: '{languageStr}'");
}
bool IsLetterChar(UnicodeCategory cat)
{
// letter-character:
// A Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl
// A Unicode-escape-sequence representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl
switch (cat)
{
case UnicodeCategory.UppercaseLetter:
case UnicodeCategory.LowercaseLetter:
case UnicodeCategory.TitlecaseLetter:
case UnicodeCategory.ModifierLetter:
case UnicodeCategory.OtherLetter:
case UnicodeCategory.LetterNumber:
return true;
}
return false;
}
string classIndent = (namespaceName == null ? "" : " ");
string memberIndent = classIndent + " ";
var strings = new StringBuilder();
foreach (var node in XDocument.Load(resxFile).Descendants("data"))
@ -18,6 +63,11 @@ foreach (var node in XDocument.Load(resxFile).Descendants("data"))
string name = node.Attribute("name")?.Value ?? throw new InvalidDataException($"Missing resource name");
string value = node.Elements("value").FirstOrDefault()?.Value.Trim() ?? throw new InvalidDataException($"Missing resource value: '{name}'");
if (name == "")
{
throw new InvalidDataException($"Empty resource name");
}
if (value.Length > maxDocCommentLength)
{
value = value.Substring(0, maxDocCommentLength) + " ...";
@ -27,28 +77,76 @@ foreach (var node in XDocument.Load(resxFile).Descendants("data"))
foreach (var line in escapedTrimmedValue.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
{
strings.Append(" /// ");
strings.Append($"{memberIndent}{(cs ? "///" : vb ? "'''" : throw null)} ");
strings.AppendLine(line);
}
strings.AppendLine($" internal static string {name} => ResourceManager.GetString(\"{name}\", Culture);");
string identifier = IsLetterChar(char.GetUnicodeCategory(name[0])) ? name : "_" + name;
if (cs)
{
strings.AppendLine($"{memberIndent}internal static string {identifier} => ResourceManager.GetString(\"{name}\", Culture);");
}
else if (vb)
{
strings.AppendLine($"{memberIndent}Friend Shared ReadOnly Property {identifier} As String");
strings.AppendLine($"{memberIndent} Get");
strings.AppendLine($"{memberIndent} Return ResourceManager.GetString(\"{name}\", Culture)");
strings.AppendLine($"{memberIndent} End Get");
strings.AppendLine($"{memberIndent}End Property");
}
else
{
throw null;
}
}
File.WriteAllText(sourceOutputPath,
string namespaceStart, namespaceEnd;
if (namespaceName == null)
{
namespaceStart = namespaceEnd = null;
}
else if (cs)
{
namespaceStart = $@"namespace {namespaceName}{Environment.NewLine}{{";
namespaceEnd = "}" + Environment.NewLine;
}
else if (vb)
{
namespaceStart = $"Namespace {namespaceName}";
namespaceEnd = "End Namespace" + Environment.NewLine;
}
else
{
throw null;
}
File.WriteAllText(sourceOutputPath, cs ?
$@"// <auto-generated>
using System;
using System.Globalization;
using System.Reflection;
using System.Resources;
namespace {namespaceName}
{{
internal static class {className}
{{
internal static CultureInfo Culture {{ get; set; }}
internal static ResourceManager ResourceManager {{ get; }} = new ResourceManager(""{resourceName}"", typeof({className}).GetTypeInfo().Assembly);
{namespaceStart}
{classIndent}internal static class {className}
{classIndent}{{
{memberIndent}internal static global::System.Globalization.CultureInfo Culture {{ get; set; }}
{memberIndent}internal static global::System.Resources.ResourceManager ResourceManager {{ get; }} = new global::System.Resources.ResourceManager(""{resourceName}"", typeof({className}).GetTypeInfo().Assembly);
{strings}
}}
}}
");
{classIndent}}}
{namespaceEnd}
" : vb ?
$@"' <auto-generated>
Imports System.Reflection
{namespaceStart}
{classIndent}Friend Class {className}
{memberIndent}Private Sub New
{memberIndent}End Sub
{memberIndent}
{memberIndent}Friend Shared Property Culture As Global.System.Globalization.CultureInfo
{memberIndent}Friend Shared ReadOnly Property ResourceManager As New Global.System.Resources.ResourceManager(""{resourceName}"", GetType({className}).GetTypeInfo().Assembly)
{strings}
{classIndent}End Class
{namespaceEnd}"
: throw null);

Просмотреть файл

@ -31,16 +31,20 @@
Inputs="@(EmbeddedResourceSG)"
Outputs="%(EmbeddedResourceSG.SourceOutputPath)">
<Exec Command='"$(ToolsetCompilerPackageDir)tools\csi.exe" "$(MSBuildThisFileDirectory)GenerateResxSource.csx" "%(EmbeddedResourceSG.FullPath)" "%(EmbeddedResourceSG.ManifestResourceName)" "%(EmbeddedResourceSG.SourceOutputPath)"' />
<Exec Command='"$(ToolsetCompilerPackageDir)tools\csi.exe" "$(MSBuildThisFileDirectory)GenerateResxSource.csx" "$(Language)" "%(EmbeddedResourceSG.FullPath)" "%(EmbeddedResourceSG.ManifestResourceName)" "%(EmbeddedResourceSG.SourceOutputPath)"' />
</Target>
<Target Name="GetEmbeddedResourcesWithSourceGeneration">
<PropertyGroup>
<_EmbeddedResourceSourceExtension Condition="'$(Language)' == 'C#'">cs</_EmbeddedResourceSourceExtension>
<_EmbeddedResourceSourceExtension Condition="'$(Language)' == 'VB'">vb</_EmbeddedResourceSourceExtension>
</PropertyGroup>
<Error Text="GenerateResxSource doesn't support language: '$(Language)'" Condition="'$(_EmbeddedResourceSourceExtension)' == ''"/>
<ItemGroup>
<!-- TODO: Avoid checking for XlfLanguage; https://github.com/dotnet/xliff-tasks/issues/19 -->
<EmbeddedResourceSG Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.GenerateSource)' == 'true' and '%(EmbeddedResource.XlfLanguage)' == ''" />
<EmbeddedResourceSG>
<SourceOutputPath>$(IntermediateOutputPath)%(EmbeddedResourceSG.ManifestResourceName).cs</SourceOutputPath>
<SourceOutputPath>$(IntermediateOutputPath)%(EmbeddedResourceSG.ManifestResourceName).$(_EmbeddedResourceSourceExtension)</SourceOutputPath>
</EmbeddedResourceSG>
</ItemGroup>
</Target>
</Project>
</Project>

Просмотреть файл

@ -1,25 +1,25 @@
<!-- 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>
<Project>
<PropertyGroup>
<DeployProjectOutput Condition="'$(DeployProjectOutput)' == ''">$(__DeployProjectOutput)</DeployProjectOutput>
</PropertyGroup>
<!-- Default empty deploy target. -->
<Target Name="Deploy" AfterTargets="Build" Condition="'$(DeployProjectOutput)' == 'true'" />
<Import Project="StrongName.targets"/>
<Import Project="GenerateInternalsVisibleTo.targets" />
<Import Project="GenerateResxSource.targets" />
<Import Project="Test.targets"/>
<Import Project="Workarounds.targets"/>
<!-- Workaround for https://github.com/Microsoft/msbuild/issues/1310 -->
<Target Name="ForceGenerationOfBindingRedirects"
AfterTargets="ResolveAssemblyReferences"
BeforeTargets="GenerateBindingRedirects"
Condition="'$(AutoGenerateBindingRedirects)' == 'true'">
<PropertyGroup>
<!-- Needs to be set in a target because it has to be set after the initial evaluation in the common targets -->
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
</Target>
<Import Project="XUnit.targets" Condition="'$(UsingToolXUnit)' == 'true'"/>
<Import Project="VisualStudio.targets" Condition="'$(UsingToolVSSDK)' == 'true' and '$(DesignTimeBuild)' != 'true' and '$(BuildingForLiveUnitTesting)' != 'true'"/>
<Import Project="OptimizationData.targets" Condition="'$(UsingToolIbcOptimization)' == 'true' and '$(IbcOptimizationDataDir)' != ''"/>
<!--
By default the SDK sets RootNamespace to the name of the project. Clear it here to avoid prefixing our namespaces.
-->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj' OR '$(Language)' == 'VB' OR '$(ProjectLanguage)' == 'VB'">
<PropertyGroup Condition="'$(Language)' == 'VB'">
<RootNamespace />
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,14 @@
<!-- 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>
<!--
When not building in CI, automatically sync .xlf files to .resx files on build.
Otherwise, let the build fail to catch .xlf files that are not up-to-date.
-->
<PropertyGroup>
<UpdateXlfOnBuild Condition="'$(CIBuild)' != 'true'">true</UpdateXlfOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="XliffTasks" Version="$(XliffTasksVersion)" PrivateAssets="all"/>
</ItemGroup>
</Project>

Двоичные данные
src/RepoToolset/MSFT.snk Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,9 @@
<?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. -->
<configuration>
<packageSources>
<clear />
<add key="roslyn-tools" value="https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

Просмотреть файл

@ -0,0 +1,32 @@
<!-- 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>
<!--
Required properties:
IbcOptimizationDataDir The directory containing IBC optimization data.
-->
<PropertyGroup>
<_OptimizationDataFile>$([System.IO.Path]::GetFullPath('$(IbcOptimizationDataDir)$(TargetName).pgo'))</_OptimizationDataFile>
</PropertyGroup>
<Target Name="ApplyOptimizations"
Condition="Exists('$(_OptimizationDataFile)')"
Inputs="@(IntermediateAssembly)"
Outputs="@(IntermediateAssembly);$(PostCompileBinaryModificationSentinelFile)">
<PropertyGroup>
<_RunIbc>false</_RunIbc>
<_RunIbc Condition="'$(Configuration)' == 'Release' and '$(OfficialBuild)' == 'true'">true</_RunIbc>
<_IbcMergePath>$(NuGetPackageRoot)\Microsoft.DotNet.IBCMerge\$(MicrosoftDotNetIBCMergeVersion)\lib\net45\ibcmerge.exe</_IbcMergePath>
<_IbcMergeCommandLineArgs>-q -f -partialNGEN -minify -mo "@(IntermediateAssembly)" -incremental "$(_OptimizationDataFile)"</_IbcMergeCommandLineArgs>
</PropertyGroup>
<Message Text="IBCMerge tool will be run in an official build with arguments: $(_IbcMergeCommandLineArgs)" Condition="'$(_RunIbc)' != 'true'" Importance="normal"/>
<Exec Command='"$(_IbcMergePath)" $(_IbcMergeCommandLineArgs)' ConsoleToMSBuild="true" Condition="'$(_RunIbc)' == 'true'">
<Output TaskParameter="ConsoleOutput" PropertyName="IbcMergeOutput" />
</Exec>
<Message Text="$(IbcMergeOutput)" />
</Target>
</Project>

Просмотреть файл

@ -1,7 +1,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>
<PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<StrongNameKeyId>MicrosoftShared</StrongNameKeyId>
<HighEntropyVA>true</HighEntropyVA>
<NeutralLanguage>en-US</NeutralLanguage>
<Company>Microsoft Corporation</Company>
@ -20,11 +21,52 @@
https://github.com/Microsoft/msbuild/issues/2202
-->
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<!--
Only generate runtimeconfig.json files for .exes of net core apps. It's unnecessary in desktop projects.
-->
<GenerateRuntimeConfigurationFiles Condition="'$(TargetFramework)' != 'netcoreapp1.1' and '$(TargetFramework)' != 'netcoreapp2.0'">false</GenerateRuntimeConfigurationFiles>
<!-- Enable IOperation analyzers -->
<Features>IOperation,$(Features)</Features>
</PropertyGroup>
<PropertyGroup Condition="'$(Language)' == ''">
<Language Condition="'$(MSBuildProjectExtension)' == '.csproj'">C#</Language>
<Language Condition="'$(MSBuildProjectExtension)' == '.vbproj'">VB</Language>
</PropertyGroup>
<!--
When building WPF / VSIX projects MSBuild will create a temporary project with an extension of
tmp_proj. In that case the SDK is unable to determine the target language and cannot pick
the correct import. Need to set it explicitly here.
See https://github.com/dotnet/project-system/issues/1467
-->
<Choose>
<When Condition="'$(MSBuildProjectExtension)' != '.csproj' and '$(MSBuildProjectExtension)' != '.vbproj' and '$(MSBuildProjectExtension)' != '.shproj'">
<Choose>
<When Condition="'$(Language)' == 'C#' or Exists('$(MSBuildProjectDirectory)\$(AssemblyName).csproj')">
<PropertyGroup>
<Language>C#</Language>
<LanguageTargets>$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>
</PropertyGroup>
</When>
<When Condition="'$(Language)' == 'VB' or Exists('$(MSBuildProjectDirectory)\$(AssemblyName).vbproj')">
<PropertyGroup>
<Language>VB</Language>
<LanguageTargets>$(MSBuildToolsPath)\Microsoft.VisualBasic.targets</LanguageTargets>
</PropertyGroup>
</When>
</Choose>
</When>
</Choose>
<Import Project="|Build precondition failed: Unable to determine the language of the project. Consider adding Directory.Build.props that sets Language property to directory '$(MSBuildProjectDirectory)'.|"
Condition="'$(Language)' == '' and '$(MSBuildProjectExtension)' != '.shproj'"/>
<Choose>
<!-- C# specific settings -->
<When Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)' == 'CSharp'">
<When Condition="'$(Language)' == 'C#'">
<PropertyGroup>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<NoWarn>$(NoWarn);1591</NoWarn>
@ -44,7 +86,7 @@
</When>
<!-- VB specific settings -->
<When Condition="'$(MSBuildProjectExtension)' == '.vbproj' OR '$(Language)' == 'VB' OR '$(ProjectLanguage)' == 'VB'">
<When Condition="'$(Language)' == 'VB'">
<PropertyGroup>
<MyType>Empty</MyType>
<OptionCompare>Binary</OptionCompare>
@ -57,12 +99,14 @@
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineTrace>true</DefineTrace>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
</When>

Просмотреть файл

@ -10,8 +10,11 @@
<ArtifactsDir>$(RepoRoot)artifacts\</ArtifactsDir>
<ArtifactsBinDir>$(ArtifactsDir)$(Configuration)\bin\</ArtifactsBinDir>
<ArtifactsObjDir>$(ArtifactsDir)$(Configuration)\obj\</ArtifactsObjDir>
<ArtifactsToolsetDir>$(ArtifactsDir)toolset\</ArtifactsToolsetDir>
<ArtifactsTestResultsDir>$(ArtifactsDir)$(Configuration)\TestResults\</ArtifactsTestResultsDir>
<PackageOutputPath>$(ArtifactsDir)$(Configuration)\packages\</PackageOutputPath>
<VisualStudioSetupOutputPath>$(ArtifactsDir)$(Configuration)\VSSetup\</VisualStudioSetupOutputPath>
<VisualStudioSetupInsertionPath>$(VisualStudioSetupOutputPath)Insertion\</VisualStudioSetupInsertionPath>
<VisualStudioSetupIntermediateOutputPath>$(ArtifactsDir)$(Configuration)\VSSetup.obj\</VisualStudioSetupIntermediateOutputPath>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,8 +1,15 @@
<!-- 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>
<Import Project="DefaultVersions.props"/>
<Import Project="ProjectLayout.props" />
<Import Project="Compiler.props" />
<Import Project="StrongName.props"/>
<Import Project="Version.props"/>
<Import Project="ProjectDefaults.props"/>
<Import Project="Test.props"/>
<Import Project="Tools.props" />
<Import Project="Tests.props" />
<Import Project="Localization.props" Condition="'$(UsingToolXliff)' == 'true'"/>
<Import Project="SourceLink.props" Condition="'$(UsingToolSourceLink)' == 'true'"/>
<Import Project="XUnit.props" Condition="'$(UsingToolXUnit)' == 'true' and ('$(IsUnitTestProject)' == 'true' or '$(IsIntegrationTestProject)' == 'true')"/>
<Import Project="VisualStudio.props" Condition="'$(UsingToolVSSDK)' == 'true'"/>
</Project>

Просмотреть файл

@ -8,7 +8,8 @@
<Import Project="$(DirectoryBuildPropsPath)" Condition="Exists('$(DirectoryBuildPropsPath)')"/>
<Import Project="RepoLayout.props" />
<Import Project="DefaultVersions.props" />
<Target Name="Sign">
<ItemGroup>
<SignToolArgs Include='-nugetPackagesPath "$(NuGetPackageRoot)\"' />

Просмотреть файл

@ -0,0 +1,13 @@
<!-- 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>
<PropertyGroup>
<!-- Generate source link when building in microbuild. -->
<SourceLinkCreate Condition="'$(OfficialBuild)' == 'true'">true</SourceLinkCreate>
<SourceLinkRepo>$(RepoRoot)</SourceLinkRepo>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="$(SourceLinkCreateCommandLineVersion)" PrivateAssets="all" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,7 @@
<!-- 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>
<PropertyGroup>
<MicrosoftSharedPublicKey>0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9</MicrosoftSharedPublicKey>
<MicrosoftPublicKey>002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293</MicrosoftPublicKey>
</PropertyGroup>
</Project>

Просмотреть файл

@ -4,6 +4,7 @@
Reads variables:
SignAssembly "true" to sign the output assembly of the current project
SignType "real" to real-sign the outputs (set by microbuild as an environment variable)
StrongNameKeyId The id of the key used for strong name generation
Writes variables:
DelaySign
@ -13,27 +14,34 @@
AssemblyOriginatorKeyFile
-->
<Choose>
<When Condition="'$(SignAssembly)' == 'true'">
<Choose>
<When Condition="'$(SignType)' == 'real'">
<PropertyGroup>
<DelaySign>true</DelaySign>
<PublicSign>false</PublicSign>
</PropertyGroup>
</When>
<When Condition="'$(SignType)' == 'real'">
<PropertyGroup>
<DelaySign>true</DelaySign>
<PublicSign>false</PublicSign>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<DelaySign>false</DelaySign>
<PublicSign>true</PublicSign>
</PropertyGroup>
</Otherwise>
</Choose>
<Otherwise>
<PropertyGroup>
<DelaySign>false</DelaySign>
<PublicSign>true</PublicSign>
</PropertyGroup>
</Otherwise>
</Choose>
<!-- Binaries are delay or public-signed with the MS key; later, the signing system will finish the strong-name signing. -->
<PropertyGroup >
<!-- Binaries are delay or public-signed with one of these keys; later, the signing system will finish the strong-name signing. -->
<Choose>
<When Condition="'$(StrongNameKeyId)' == 'Microsoft'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)MSFT.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(MicrosoftPublicKey)</PublicKey>
<PublicKeyToken>b03f5f7f11d50a3a</PublicKeyToken>
</PropertyGroup>
</When>
<When Condition="'$(StrongNameKeyId)' == 'MicrosoftShared'">
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<PublicKey>0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9</PublicKey>
<PublicKey>$(MicrosoftSharedPublicKey)</PublicKey>
<PublicKeyToken>31BF3856AD364E35</PublicKeyToken>
</PropertyGroup>
</When>
@ -63,5 +71,9 @@
<Target Name="VerifyBuildFlags">
<Error Condition="('$(SignType)' == 'real') AND '$(AssemblyVersion)' == '42.42.42.42'"
Text="Must specify a build version in order to real sign a build." />
<Error Condition="'$(SignAssembly)' != 'true'"
Text="SignAssembly must be true" />
<Error Condition="'$(PublicKey)' == '' or '$(PublicKeyToken)' == '' or '$(AssemblyOriginatorKeyFile)' == ''"
Text="PublicKey, PublicKeyToken and AssemblyOriginatorKeyFile must be specified" />
</Target>
</Project>

Просмотреть файл

@ -1,21 +0,0 @@
<!-- 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>
<PropertyGroup>
<IsTestProject Condition="$(MSBuildProjectName.EndsWith('UnitTests'))">true</IsTestProject>
</PropertyGroup>
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<!-- VS TestExplorer uses this to identify a test project -->
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
<!-- Test dependencies -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" />
<!-- Test runner configuration -->
<None Include="$(MSBuildProjectName).xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,74 +0,0 @@
<!-- 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>
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<TestArchitectures Condition="'$(TestArchitectures)' == ''">x64</TestArchitectures>
<AutoGenerateBindingRedirects Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">true</AutoGenerateBindingRedirects>
<_TestTargetName Condition="'$(TargetFrameworks)' == ''">InnerTest</_TestTargetName>
<_TestTargetName Condition="'$(TargetFrameworks)' != ''">OuterTest</_TestTargetName>
<_TestUsingDotNetCli>false</_TestUsingDotNetCli>
<_TestUsingDotNetCli Condition="Exists('$(DotNetTool)')">true</_TestUsingDotNetCli>
</PropertyGroup>
<Target Name="Test" DependsOnTargets="$(_TestTargetName)" Condition="'$(IsTestProject)' == 'true'" />
<ItemGroup>
<_TestArchitectureItems Include="$(TestArchitectures)" />
</ItemGroup>
<!-- Using Inputs/Outputs just to loop over test architectures -->
<Target Name="InnerTest" Inputs="*%(_TestArchitectureItems.Identity)" Outputs="*%(_TestArchitectureItems.Identity)" Returns="@(_FailedTestRuns)">
<Error Text="Property not set: XUnitRunnerConsoleVersion" Condition="'$(_TestUsingDotNetCli)' != 'true' and '$(XUnitRunnerConsoleVersion)' == ''"/>
<PropertyGroup>
<_TestArchitecture>%(_TestArchitectureItems.Identity)</_TestArchitecture>
<_TestEnvironment>$(TargetFramework)|$(_TestArchitecture)</_TestEnvironment>
<_TestOutPathNoExt>$(ArtifactsTestResultsDir)$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture)</_TestOutPathNoExt>
<_TestStdOutPath>$(_TestOutPathNoExt).log</_TestStdOutPath>
<_TestLogPath>$(_TestOutPathNoExt).xml</_TestLogPath>
</PropertyGroup>
<PropertyGroup Condition="'$(_TestUsingDotNetCli)' == 'true'">
<_TestLogger>xunit;LogFilePath="$(_TestLogPath)";Environment="$(_TestEnvironment)";XUnitVersion="$(XUnitVersion)"</_TestLogger>
<_TestRunnerCommand>"$(DotNetTool)" test "$(MSBuildProjectFullPath)" --no-build --framework:$(TargetFramework) --configuration:$(Configuration) --logger:$(_TestLogger) -- --platform:$(_TestArchitecture)</_TestRunnerCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(_TestUsingDotNetCli)' != 'true'">
<_XUnitConsoleExe>xunit.console.exe</_XUnitConsoleExe>
<_XUnitConsoleExe Condition="'$(_TestArchitecture)' == 'x86'">xunit.console.x86.exe</_XUnitConsoleExe>
<_TestRunnerCommand>"$(NuGetPackageRoot)xunit.runner.console\$(XUnitRunnerConsoleVersion)\tools\$(_XUnitConsoleExe)" "$(TargetPath)" -verbose -xml "$(_TestLogPath)"</_TestRunnerCommand>
</PropertyGroup>
<MakeDir Directories="$(ArtifactsTestResultsDir)"/>
<Delete Files="$(_TestOutPathNoExt)" />
<Delete Files="$(_TestStdOutPath)" />
<Exec Command='$(_TestRunnerCommand) > $(_TestStdOutPath)'
LogStandardErrorAsError="true"
WorkingDirectory="$(OutDir)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="_TestErrorCode" />
</Exec>
<ItemGroup>
<_FailedTestRuns Include="$(_TestEnvironment)" Condition="'$(_TestErrorCode)' != '0'" />
</ItemGroup>
<Message Text="Test succeeded: $(MSBuildProjectName) [$(_TestEnvironment)]" Condition="'$(_TestErrorCode)' == '0'" />
<Warning Text="Test failed: $(MSBuildProjectName) [$(_TestEnvironment)]" Condition="'$(_TestErrorCode)' != '0'" />
</Target>
<Target Name="OuterTest" Returns="@(InnerOutput)">
<ItemGroup>
<_TargetFramework Include="$(TargetFrameworks)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)"
Condition="'$(TargetFrameworks)' != '' "
Targets="InnerTest"
Properties="TargetFramework=%(_TargetFramework.Identity)">
<Output ItemName="_FailedTestRuns" TaskParameter="TargetOutputs" />
</MSBuild>
<Error Text="Tests failed on platforms: @(_FailedTestRuns, ', ')" Condition="'@(_FailedTestRuns)' != ''" />
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,25 @@
<!-- 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>
<PropertyGroup Condition="'$(IsIntegrationTestProject)' == ''">
<IsIntegrationTestProject>false</IsIntegrationTestProject>
<IsIntegrationTestProject Condition="$(MSBuildProjectName.EndsWith('.IntegrationTests'))">true</IsIntegrationTestProject>
</PropertyGroup>
<PropertyGroup Condition="'$(IsUnitTestProject)' == ''">
<IsUnitTestProject>false</IsUnitTestProject>
<IsUnitTestProject Condition="$(MSBuildProjectName.EndsWith('.UnitTests'))">true</IsUnitTestProject>
</PropertyGroup>
<PropertyGroup>
<IsTestProject>false</IsTestProject>
<IsTestProject Condition="'$(IsUnitTestProject)' == 'true' or '$(IsIntegrationTestProject)' == 'true'">true</IsTestProject>
<!-- Disable building Integration Test projects in LUT. -->
<BuildForLiveUnitTesting Condition="'$(BuildForLiveUnitTesting)' == '' and '$(IsIntegrationTestProject)' == 'true'">false</BuildForLiveUnitTesting>
</PropertyGroup>
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<!-- VS TestExplorer uses this to identify a test project -->
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,16 @@
<!-- 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 Sdk="Microsoft.NET.Sdk">
<!--
Used to restore global toolset packages.
-->
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RoslynTools.Microsoft.SignTool" Version="$(RoslynToolsMicrosoftSignToolVersion)" />
<PackageReference Include="MicroBuild.Core" Version="$(MicroBuildCoreVersion)" />
<PackageReference Include="MicroBuild.Core.Sentinel" Version="1.0.0" />
<PackageReference Include="MicroBuild.Plugins.SwixBuild" Version="$(MicroBuildPluginsSwixBuildVersion)" Condition="'$(UsingToolVSSDK)' == 'true'" />
<PackageReference Include="Microsoft.Net.Compilers" Version="$(MicrosoftNetCompilersVersion)" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,6 @@
<!-- 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>
<PropertyGroup>
<ToolsetCompilerPackageDir>$(NuGetPackageRoot)Microsoft.Net.Compilers\$(MicrosoftNetCompilersVersion)\</ToolsetCompilerPackageDir>
</PropertyGroup>
</Project>

Просмотреть файл

@ -21,14 +21,16 @@
-->
<Import Project="GitHash.props" Condition="'$(BUILD_BUILDNUMBER)' != ''"/>
<PropertyGroup>
<AssemblyVersion>$(VersionBase).0</AssemblyVersion>
<OfficialBuild>false</OfficialBuild>
<OfficialBuild Condition="'$(BUILD_BUILDNUMBER)' != ''">true</OfficialBuild>
</PropertyGroup>
<Import Project="GitHash.props" Condition="'$(OfficialBuild)' == 'true'"/>
<Choose>
<When Condition="'$(BUILD_BUILDNUMBER)' != ''">
<When Condition="'$(OfficialBuild)' == 'true'">
<PropertyGroup>
<_BuildNumberFiveDigitDateStamp>$([MSBuild]::Subtract($(BUILD_BUILDNUMBER.Split('.')[0].Substring(3).Trim()), 8800))</_BuildNumberFiveDigitDateStamp>
<_BuildNumberBuildOfTheDayPadded>$(BUILD_BUILDNUMBER.Split('.')[1].PadLeft(2,'0'))</_BuildNumberBuildOfTheDayPadded>

Просмотреть файл

@ -0,0 +1,3 @@
<Project>
<Import Project="$(VSToolsPath)\vssdk\Microsoft.VsSDK.targets"/>
</Project>

Просмотреть файл

@ -0,0 +1,72 @@
<!-- 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 DefaultTargets="Pack">
<!--
Required parameters:
DirectoryBuildPropsPath Path to the Directory.Build.props file in the repo root.
-->
<Import Project="$(DirectoryBuildPropsPath)" Condition="Exists('$(DirectoryBuildPropsPath)')"/>
<Import Project="DefaultVersions.props"/>
<Import Project="RepoLayout.props" />
<ItemGroup>
<_StubFiles Include="$(VisualStudioSetupIntermediateOutputPath)**\*.stub"/>
<_StubDirs Include="@(_StubFiles->'%(RecursiveDir)')"/>
</ItemGroup>
<!--
TODO: Currently we need to erase Experimental flag from VSIXes that are inserted into VS.
The build produces VSIXes to VisualStudioSetupPath that need this treatment.
This task copies them to VisualStudioSetupInsertionPath and removes the flag from the manifest.
-->
<Target Name="PrepareVsixes" Outputs="%(_StubFiles.Identity)">
<ReadLinesFromFile File="%(_StubFiles.Identity)">
<Output TaskParameter="Lines" ItemName="_StubLines" />
</ReadLinesFromFile>
<PropertyGroup>
<_VsixFileName>@(_StubLines)</_VsixFileName>
<_JsonFileName>%(_StubFiles.FileName).json</_JsonFileName>
<_RemoveExperimentalFlag>false</_RemoveExperimentalFlag>
<_RemoveExperimentalFlag Condition="Exists('$(VisualStudioSetupOutputPath)$(_VsixFileName)')">true</_RemoveExperimentalFlag>
</PropertyGroup>
<MakeDir Directories="$(VisualStudioSetupInsertionPath)"/>
<Copy SourceFiles="$(VisualStudioSetupOutputPath)$(_VsixFileName);$(VisualStudioSetupOutputPath)$(_JsonFileName)"
DestinationFolder="$(VisualStudioSetupInsertionPath)"
Condition="'$(_RemoveExperimentalFlag)' == 'true'"/>
<PropertyGroup>
<_ModifyVsixManifestToolExe>$(NuGetPackageRoot)\RoslynTools.Microsoft.ModifyVsixManifest\$(RoslynToolsMicrosoftModifyVsixManifestVersion)\tools\ModifyVsixManifest.exe</_ModifyVsixManifestToolExe>
<_ModifyVsixManifestArgs>--remove=//x:PackageManifest/x:Installation/@Experimental --add-attribute=//x:PackageManifest/x:Installation;SystemComponent;true</_ModifyVsixManifestArgs>
</PropertyGroup>
<Exec Command='"$(_ModifyVsixManifestToolExe)" --vsix="$(VisualStudioSetupInsertionPath)$(_VsixFileName)" $(_ModifyVsixManifestArgs)'
Condition="'$(_RemoveExperimentalFlag)' == 'true'"/>
<ItemGroup Condition="'$(_RemoveExperimentalFlag)' == 'true'">
<FileWrites Include="$(VisualStudioSetupInsertionPath)$(_VsixFileName);$(VisualStudioSetupInsertionPath)$(_JsonFileName)"/>
</ItemGroup>
</Target>
<Target Name="Pack" DependsOnTargets="PrepareVsixes" Outputs="%(_StubDirs.Identity)">
<PropertyGroup>
<_ComponentDir>%(_StubDirs.Identity)</_ComponentDir>
<_ComponentName>$(_ComponentDir.TrimEnd('\'))</_ComponentName>
</PropertyGroup>
<ItemGroup>
<_Args Include="ComponentName=$(_ComponentName)"/>
<_Args Include="SetupOutputPath=$(VisualStudioSetupInsertionPath)"/>
<_Args Include="ComponentIntermediateOutputPath=$(VisualStudioSetupIntermediateOutputPath)$(_ComponentName)\"/>
<_Args Include="MicroBuildPath=$(NuGetPackageRoot)MicroBuild.Core\$(MicroBuildCoreVersion)\"/>
</ItemGroup>
<Message Text="Packaging VS component '$(_ComponentName)'" Importance="high"/>
<MSBuild Projects="VisualStudio.SetupPackage.vsmanproj" Properties="@(_Args)"/>
</Target>
</Project>

Просмотреть файл

@ -1,41 +0,0 @@
<!-- 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 DefaultTargets="Pack">
<!--
Required parameters:
DirectoryBuildPropsPath Path to the Directory.Build.props file in the repo root.
-->
<Import Project="$(DirectoryBuildPropsPath)" Condition="Exists('$(DirectoryBuildPropsPath)')"/>
<Import Project="RepoLayout.props" />
<ItemGroup>
<_VisualStudioSetupComponents Include="$(VisualStudioSetupOutputPath)**\*.json"/>
</ItemGroup>
<!-- Using Inputs/Outputs just to loop over components -->
<Target
Name="Pack"
Inputs="*%(_VisualStudioSetupComponents.Identity)"
Outputs="*%(_VisualStudioSetupComponents.Identity)"
Condition="Exists('$(VisualStudioSetupOutputPath)')">
<PropertyGroup>
<_ComponentDir>%(_VisualStudioSetupComponents.RecursiveDir)</_ComponentDir>
<_ComponentName>%(_VisualStudioSetupComponents.Filename)</_ComponentName>
<_SetupIntermediateOutputPath>$(ArtifactsDir)$(Configuration)\VSSetup.obj\$(_ComponentDir)</_SetupIntermediateOutputPath>
<_ComponentProj>$(_SetupIntermediateOutputPath)\$(_ComponentName).vsmanproj</_ComponentProj>
</PropertyGroup>
<ItemGroup>
<_Args Include="SetupOutputPath=$(VisualStudioSetupOutputPath)$(_ComponentDir)"/>
<_Args Include="SetupIntermediateOutputPath=$(_SetupIntermediateOutputPath)"/>
<_Args Include="MicroBuildPath=$(NuGetPackageRoot)MicroBuild.Core\$(MicroBuildCoreVersion)\"/>
</ItemGroup>
<Copy SourceFiles="$(MSBuildThisFileDirectory)VisualStudio.SetupPackage.vsmanproj" DestinationFiles="$(_ComponentProj)" />
<MSBuild Projects="$(_ComponentProj)" Properties="@(_Args)"/>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,37 @@
<!-- 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="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Required variables:
SwrProperties Properties and their values ("Prop1=Value1;Prop2=Value2;...") to be substituted in the swr files.
SwrFiles Files to be included.
SwrPackageName Name of the component (VSIX)
IntermediateOutputPath Intermediate output path.
MicroBuildPath MicroBuild package path.
-->
<PropertyGroup>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<OutputArchitecture>neutral</OutputArchitecture>
<OutputLocalized>false</OutputLocalized>
<OutputType>vsix</OutputType>
<IsPackage>true</IsPackage>
<OutputName>$(SwrPackageName)</OutputName>
</PropertyGroup>
<Import Project="$(MicroBuildPath)build\MicroBuild.Core.props" />
<ItemGroup>
<_SwrProperties Include="$([MSBuild]::Unescape($(SwrProperties)))" />
</ItemGroup>
<PropertyGroup>
<PackagePreprocessorDefinitions>$(PackagePreprocessorDefinitions);@(_SwrProperties)</PackagePreprocessorDefinitions>
<OutputPath>$(IntermediateOutputPath)</OutputPath>
</PropertyGroup>
<ItemGroup>
<Package Include="$(SwrFiles)" />
</ItemGroup>
<Import Project="$(MicroBuildPath)build\MicroBuild.Core.targets" />
</Project>

Просмотреть файл

@ -1,12 +1,13 @@
<!-- 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>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Required variables:
SetupOutputPath Directory to drop the VSIX to.
SetupIntermediateOutputPath Intermediate directory.
MicroBuildPath MicroBuild package path.
ComponentName Name of the component (VSIX)
SetupOutputPath Directory to drop Willow manifests to.
ComponentIntermediateOutputPath Intermediate directory where the component is being built.
MicroBuildPath MicroBuild package path.
-->
<PropertyGroup>
<ResolveNuGetPackages>false</ResolveNuGetPackages>
<ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
@ -20,17 +21,19 @@
<FinalizeSkipLayout>true</FinalizeSkipLayout>
<IsPackage>true</IsPackage>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetName>$(ComponentName)</TargetName>
<OutputPath>$(SetupOutputPath)</OutputPath>
<IntermediateOutputPath>$(SetupIntermediateOutputPath)</IntermediateOutputPath>
<IntermediateOutputPath>$(ComponentIntermediateOutputPath)</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<_PackageStubFiles Include="$(ComponentIntermediateOutputPath)*.stub"/>
<MergeManifest Include="@(_PackageStubFiles->'$(SetupOutputPath)%(Filename).json')"/>
</ItemGroup>
<PropertyGroup Condition="'$(BUILD_BUILDNUMBER)' == ''">
<FinalizeManifest>false</FinalizeManifest>
</PropertyGroup>
<ItemGroup>
<MergeManifest Include="$(SetupOutputPath)*.json" />
</ItemGroup>
<Import Project="$(MicroBuildPath)build\MicroBuild.Core.targets" />
</Project>

Просмотреть файл

@ -1,18 +1,30 @@
<!-- 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>
<!-- VSSDK target to build VSIX -->
<Import Project="$(NuGetPackageRoot)Microsoft.VSSDK.BuildTools\$(MicrosoftVSSDKBuildToolsVersion)\build\Microsoft.VsSDK.BuildTools.props" />
<!-- VSIX settings -->
<PropertyGroup>
<DeployExtension Condition="'$(DeployExtension)' == '' and '$(CIBuild)' != 'true'">true</DeployExtension>
<DeployExtension Condition="'$(DeployExtension)' == '' and '$(CIBuild)' == 'true'">false</DeployExtension>
<VsixSourceManifestPath>$(MSBuildProjectDirectory)\source.extension.vsixmanifest</VsixSourceManifestPath>
<IsVsixProject>false</IsVsixProject>
<IsVsixProject Condition="Exists('$(VsixSourceManifestPath)')">true</IsVsixProject>
</PropertyGroup>
<ItemGroup Condition="'$(IsVsixProject)' == 'true'">
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="$(MicrosoftVSSDKBuildToolsVersion)" />
</ItemGroup>
<PropertyGroup Condition="'$(IsVsixProject)' == 'true'">
<BuildForLiveUnitTesting>false</BuildForLiveUnitTesting>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log</StartArguments>
<UseCodebase>true</UseCodebase>
<IsProductComponent>true</IsProductComponent>
<Ngen>true</Ngen>
<NgenArchitecture>All</NgenArchitecture>
<NgenPriority>3</NgenPriority>
</PropertyGroup>
<PropertyGroup>
<UseCodebase>true</UseCodebase>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,12 +1,135 @@
<!-- 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>
<!--
There are three kinds of projects that use targets defined here:
1) Projects using VS SDK to build VSIX packages: IsVsixProject == true, CreateVsixContainer == true
2) Projects using VS SDK to generate .pkgdef files: IsVsixProject == true, GeneratePkgDefFile == true
3) Projects that pack Willow packages (swix): SwrFile items present
-->
<PropertyGroup>
<!--
TODO: Currently we need to erase Experimental flag from VSIXes that are inserted into VS.
The build produces VSIXes with the flag and Pack target then makes a copy to VisualStudioSetupInsertionPath
and updates the manifest.
Instead the VSIX installer should allow to override the experimental flag, so that we can only produce a single VSIX and
build VSIX that is going to be inserted into VS directrly to directory $(VisualStudioSetupInsertionPath).
-->
<_TargetVsixContainerDir>$(VisualStudioSetupOutputPath)</_TargetVsixContainerDir>
<TargetVsixContainerName Condition="'$(TargetVsixContainerName)' == ''">$(TargetName).vsix</TargetVsixContainerName>
<TargetVsixContainer Condition="'$(TargetVsixContainer)' == ''">$(_TargetVsixContainerDir)$(TargetVsixContainerName)</TargetVsixContainer>
<DeployExtension>false</DeployExtension>
<DeployExtension Condition="'$(DeployProjectOutput)' == 'true'">true</DeployExtension>
<_ComponentIntermediateDir Condition="'$(VisualStudioInsertionComponent)' != ''">$(VisualStudioSetupIntermediateOutputPath)$(VisualStudioInsertionComponent)\</_ComponentIntermediateDir>
</PropertyGroup>
<!--
The VSSDK immplements some targets which are run during design time builds per convention.
If the Project is not a VSIX project and sets $CreateVSIXContainer=false these targets should be
a no-op. However they dont check for that and that's a bug. To workaround, we override them
with empty targets and conditionally import these if CreateVSIXContainer is false.
Tracked by https://devdiv.visualstudio.com/DevDiv/_workitems?id=365685&fullScreen=false&_a=edit
-->
<Import Project="VisualStudio.DesignTimeBuild.targets" Condition="'$(CreateVsixContainer)' == 'false'"/>
Read package id from the extension.vsixmanifest file. VS SDK doesn't expose this value in any msbuild property.
-->
<Target Name="_SetStubFileNameFromManifest">
<PropertyGroup>
<_VsxXmlNamespace>&lt;Namespace Prefix='vsx' Uri='http://schemas.microsoft.com/developer/vsx-schema/2011'/&gt;</_VsxXmlNamespace>
</PropertyGroup>
<XmlPeek Namespaces="$(_VsxXmlNamespace)"
XmlInputPath="$(IntermediateVsixManifest)"
Query="/vsx:PackageManifest/vsx:Metadata/vsx:PackageId/text()">
<Output TaskParameter="Result" PropertyName="_VsixPackageId" />
</XmlPeek>
<XmlPeek Namespaces="$(_VsxXmlNamespace)"
XmlInputPath="$(IntermediateVsixManifest)"
Query="/vsx:PackageManifest/vsx:Metadata/vsx:Identity/@Id"
Condition="'$(_VsixPackageId)' == ''">
<Output TaskParameter="Result" PropertyName="_VsixPackageId" />
</XmlPeek>
<Error Text="Unable to determine VSIX package id for project '$(MSBuildProjectFullPath)'." Condition="'$(_VsixPackageId)' == ''"/>
<PropertyGroup>
<_PackageStubFile>$(_ComponentIntermediateDir)$(_VsixPackageId).stub</_PackageStubFile>
</PropertyGroup>
</Target>
<!--
Create VSIX container directory.
-->
<Target Name="_MakeTargetVsixContainerDir"
BeforeTargets="CreateVsixContainer"
Condition="'$(CreateVsixContainer)' == 'true'"
Outputs="$(_TargetVsixContainerDir)">
<MakeDir Directories="$(_TargetVsixContainerDir)" />
</Target>
<!--
Create VSIX container directory and a stub file that can be used in Pack phase to identify what VSIXes belong to the component.
-->
<Target Name="_WriteComponentStubFile" Outputs="$(_PackageStubFile)">
<Error Text="VisualStudioInsertionComponent property must only be set for projects with extension.vsixmanifest or SWR files." Condition="'$(_PackageStubFile)' == ''"/>
<MakeDir Directories="$(_ComponentIntermediateDir)" />
<WriteLinesToFile File="$(_PackageStubFile)" Lines="$(TargetVsixContainerName)" Overwrite="true" />
<ItemGroup>
<FileWrites Include="$(_PackageStubFile)"/>
</ItemGroup>
</Target>
<Target Name="_WriteComponentStubFileForVsixContainer"
BeforeTargets="CreateVsixContainer"
DependsOnTargets="_SetStubFileNameFromManifest;_WriteComponentStubFile"
Condition="'$(CreateVsixContainer)' == 'true' and '$(VisualStudioInsertionComponent)' != ''"/>
<Target Name="ValidateSingleSwixVersion" BeforeTargets="Pack">
<ItemGroup>
<_SwixNugets Include="$(NuGetPackageRoot)MicroBuild.Plugins.swixbuild\**\*.nupkg"/>
</ItemGroup>
<Error Text="MicroBuild only supports a single version of MicroBuild.Plugins.swixbuild package in the nuget cache. Found the following: @(_SwixNugets, ', ')"
Condition="'@(_SwixNugets->Count())' != '1'"
ContinueOnError="false" />
</Target>
<!--
Packaging SWR files to Willow VSIX.
-->
<Target Name="SwixPack"
DependsOnTargets="_SetStubFileNameForSwixProject;_WriteComponentStubFile"
AfterTargets="Pack"
Condition="'@(SwrFile)' != ''">
<PropertyGroup>
<_SwrProperties>@(SwrProperty)</_SwrProperties>
<_SwrFiles>@(SwrFile->'%(FullPath)')</_SwrFiles>
</PropertyGroup>
<ItemGroup>
<_SwixArgs Include="SwrProperties=$([MSBuild]::Escape($(_SwrProperties)))"/>
<_SwixArgs Include="SwrFiles=$([MSBuild]::Escape($(_SwrFiles)))"/>
<_SwixArgs Include="SwrPackageName=$(TargetName)"/>
<_SwixArgs Include="IntermediateOutputPath=$(IntermediateOutputPath)"/>
<_SwixArgs Include="MicroBuildPath=$(NuGetPackageRoot)MicroBuild.Core\$(MicroBuildCoreVersion)\"/>
</ItemGroup>
<MSBuild Projects="$(RepoToolsetDir)VisualStudio.SetupPackage.swixproj" Properties="@(_SwixArgs)" Targets="Build"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).vsix;$(IntermediateOutputPath)$(TargetName).json"
DestinationFolder="$(VisualStudioSetupInsertionPath)" />
<ItemGroup>
<FileWrites Include="$(VisualStudioSetupInsertionPath)$(TargetName).vsix"/>
<FileWrites Include="$(VisualStudioSetupInsertionPath)$(TargetName).json"/>
</ItemGroup>
</Target>
<Target Name="_SetStubFileNameForSwixProject">
<PropertyGroup>
<_PackageStubFile>$(_ComponentIntermediateDir)$(TargetName).stub</_PackageStubFile>
</PropertyGroup>
</Target>
<!--
This is a workaround for allowing neutral CTO resource produced from *.vsct to go in the main assembly.
@ -38,27 +161,35 @@
</_ResourcesToMergeWithCTOWithCultureMetadata>
</ItemGroup>
</Target>
<ItemGroup>
<!-- Include manifest -->
<_VsixPayload Include="$(OutputPath)$(VsixPackageId).json" />
<!-- Include .vsix -->
<_VsixPayload Include="$(OutputPath)$(MSBuildProjectName).vsix" />
</ItemGroup>
<!-- Copy VS setup components to the VS setup output dir -->
<Target Name="CopyVisualStudioSetupComponents"
AfterTargets="Build"
DependsOnTargets="Build"
Condition="'$(VisualStudioSetupComponent)' != '' and '$(DesignTimeBuild)' != 'true' and '$(BuildingForLiveUnitTesting)' != 'true'">
<Copy SourceFiles="@(_VsixPayload)" DestinationFolder="$(VisualStudioSetupOutputPath)$(VisualStudioSetupComponent)" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="true" />
<!--
The VSSDK implements some targets which are run during design time builds per convention.
If the Project is not a VSIX project and sets $CreateVSIXContainer=false these targets should be
a no-op. However they dont check for that and that's a bug. To workaround, we override them
with empty targets and conditionally import these if CreateVSIXContainer is false.
Tracked by https://devdiv.visualstudio.com/DevDiv/_workitems?id=365685&fullScreen=false&_a=edit
-->
<Import Project="VisualStudio.DesignTimeBuild.targets" Condition="'$(CreateVsixContainer)' != 'true'"/>
<Import Project="VisualStudio.ImportSdk.targets" Condition="'$(VSToolsPath)' != ''" />
<!--
Support for templates.
-->
<Target Name="GetVsixTemplateItems" DependsOnTargets="ZipProjects;ZipItems">
<ItemGroup>
<VSIXSourceItem Include="@(IntermediateZipItem)">
<VSIXSubPath>%(IntermediateZipItem.Filename)\%(IntermediateZipItem.Language)\%(IntermediateZipItem.OutputSubPath)\%(IntermediateZipItem.Culture)</VSIXSubPath>
</VSIXSourceItem>
<VSIXSourceItem Include="@(IntermediateZipProject)">
<VSIXSubPath>%(IntermediateZipProject.Filename)\%(IntermediateZipProject.Language)\%(IntermediateZipProject.OutputSubPath)\%(IntermediateZipProject.Culture)</VSIXSubPath>
</VSIXSourceItem>
</ItemGroup>
</Target>
<Import Project="$(NuGetPackageRoot)Microsoft.VSSDK.BuildTools\$(MicrosoftVSSDKBuildToolsVersion)\build\Microsoft.VsSDK.BuildTools.targets" />
<Import Project="$(VSToolsPath)\vssdk\Microsoft.VsSDK.targets" />
<PropertyGroup>
<GetVsixSourceItemsDependsOn>$(GetVsixSourceItemsDependsOn);GetVsixTemplateItems</GetVsixSourceItemsDependsOn>
</PropertyGroup>
<!-- Returns the current build version. Used in .vsixmanifests to substitute our build version into them -->
<Target Name="GetBuildVersion" Outputs="$(VsixVersion)" />
</Project>
</Project>

Просмотреть файл

@ -0,0 +1,73 @@
<!-- 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>
<!-- Workaround for https://github.com/Microsoft/msbuild/issues/1310 -->
<Target Name="ForceGenerationOfBindingRedirects"
AfterTargets="ResolveAssemblyReferences"
BeforeTargets="GenerateBindingRedirects"
Condition="'$(AutoGenerateBindingRedirects)' == 'true'">
<PropertyGroup>
<!-- Needs to be set in a target because it has to be set after the initial evaluation in the common targets -->
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
</Target>
<!--
Workaround to fix IntelliSense file generation for XAML projects
https://github.com/dotnet/project-system/issues/2488
-->
<Target Name="WorkaroundForXamlIntelliSenseBuildIssue" AfterTargets="_CheckCompileDesignTimePrerequisite">
<PropertyGroup>
<BuildingProject>false</BuildingProject>
</PropertyGroup>
</Target>
<!--
Workaround: In order to leverage LUT testing we need to have both of the following packages:
- xunit.runner.desktop
- xunit
Both of these include xunit.abstractions.dll in different forms: content and reference
respectively. This creates a double write violation in our build. The content item
is unnecessary for us since we reference the xunit package hence remove it here.
https://github.com/dotnet/roslyn/issues/18753
-->
<Target Name="RemoveDuplicateXUnitContent">
<ItemGroup>
<Content Remove="@(Content)" Condition="'%(Filename)%(Extension)' == 'xunit.abstractions.dll'" />
</ItemGroup>
</Target>
<!--
Work around bug in Microsoft.NET.Sdk < v2.0 where satellites were deployed on top of each other in root.
https://github.com/dotnet/sdk/issues/1360
-->
<Target Name="WorkaroundIncorrectSatelliteDeployment" AfterTargets="ResolveLockFileCopyLocalProjectDeps">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ResourceCopyLocalItems)" />
<ReferenceCopyLocalPaths Include="@(ResourceCopyLocalItems)" Condition="'@(ResourceCopyLocalItems)' != ''">
<DestinationSubDirectory>$([System.IO.Directory]::GetParent(%(ResourceCopyLocalItems.FullPath)).get_Name())\</DestinationSubDirectory>
</ReferenceCopyLocalPaths>
</ItemGroup>
</Target>
<!--
XAML targets create a temp project with OutDir set, which makes the SDK create an empty directory for it,
polluting the output dir. Avoid creating these directories.
https://github.com/dotnet/sdk/issues/1367
-->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.tmp_proj'">
<OutDir/>
</PropertyGroup>
<!--
Workaround for PathTooLongException (see https://github.com/Microsoft/msbuild/issues/1786).
-->
<Target Name="WorkaroundAppConfigPathTooLong"
BeforeTargets="GenerateBindingRedirects">
<PropertyGroup>
<_GenerateBindingRedirectsIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).config</_GenerateBindingRedirectsIntermediateAppConfig>
</PropertyGroup>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,25 @@
<!-- 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>
<PropertyGroup>
<_DotNetCliToolExists>false</_DotNetCliToolExists>
<_DotNetCliToolExists Condition="Exists('$(DotNetTool)')">true</_DotNetCliToolExists>
<TestUsingDotNetCli Condition="'$(TestUsingDotNetCli)' == ''">$(_DotNetCliToolExists)</TestUsingDotNetCli>
</PropertyGroup>
<ItemGroup>
<!-- Test dependencies -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)" />
<PackageReference Include="xunit.runner.console" Version="$(XUnitVersion)" Condition="'$(TestUsingDotNetCli)' != 'true'"/>
<!-- Test runner configuration -->
<None Include="$(XUnitConfigurationFile)" Condition="'$(XUnitConfigurationFile)' != '' and '$(XUnitConfigurationFile)' != 'Default'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)xunit.runner.json" Condition="'$(XUnitConfigurationFile)' == 'Default'">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,113 @@
<!-- 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>
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<AutoGenerateBindingRedirects Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">true</AutoGenerateBindingRedirects>
<_TestTargetName Condition="'$(TargetFrameworks)' == ''">InnerTest</_TestTargetName>
<_TestTargetName Condition="'$(TargetFrameworks)' != ''">OuterTest</_TestTargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(TestArchitectures)' == ''">
<TestArchitectures>$(PlatformTarget)</TestArchitectures>
<TestArchitectures Condition="'$(PlatformTarget)' == '' or '$(PlatformTarget)' == 'AnyCpu'">x64</TestArchitectures>
</PropertyGroup>
<Target Name="Test" DependsOnTargets="$(_TestTargetName)" Condition="'$(IsUnitTestProject)' == 'true'" />
<Target Name="IntegrationTest" DependsOnTargets="$(_TestTargetName)" Condition="'$(IsIntegrationTestProject)' == 'true'" />
<ItemGroup>
<_TestArchitectureItems Include="$(TestArchitectures)" />
</ItemGroup>
<!-- Using Inputs/Outputs just to loop over test architectures -->
<Target Name="InnerTest" Inputs="*%(_TestArchitectureItems.Identity)" Outputs="*%(_TestArchitectureItems.Identity)" Returns="@(_FailedTestRuns)">
<PropertyGroup>
<_TestArchitecture>%(_TestArchitectureItems.Identity)</_TestArchitecture>
<_TestEnvironment>$(TargetFramework)|$(_TestArchitecture)</_TestEnvironment>
<_TestOutPathNoExt>$(ArtifactsTestResultsDir)$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture)</_TestOutPathNoExt>
<_TestStdOutPath>$(_TestOutPathNoExt).log</_TestStdOutPath>
<_TestLogPath>$(_TestOutPathNoExt).xml</_TestLogPath>
<_TargetFileNameNoExt>$([System.IO.Path]::GetFileNameWithoutExtension('$(TargetFileName)'))</_TargetFileNameNoExt>
<_CoreRuntimeConfigPath>$(TargetDir)$(_TargetFileNameNoExt).runtimeconfig.json</_CoreRuntimeConfigPath>
<_CoreDepsPath>$(TargetDir)$(_TargetFileNameNoExt).deps.json</_CoreDepsPath>
<_RunOnCore>false</_RunOnCore>
<_RunOnCore Condition="'$(TestUsingDotNetCli)' == 'true' and $(TargetFramework.StartsWith('netcoreapp'))">true</_RunOnCore>
</PropertyGroup>
<PropertyGroup Condition="'$(_RunOnCore)' == 'true'">
<_TestRunnerCommand>"$(DotNetTool)" exec --depsfile "$(_CoreDepsPath)" --runtimeconfig "$(_CoreRuntimeConfigPath)" "$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\netcoreapp1.0\xunit.console.dll" "$(TargetPath)" -noautoreporters -xml "$(_TestLogPath)"</_TestRunnerCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(_RunOnCore)' != 'true'">
<_XUnitConsoleExe>xunit.console.exe</_XUnitConsoleExe>
<_XUnitConsoleExe Condition="'$(_TestArchitecture)' == 'x86'">xunit.console.x86.exe</_XUnitConsoleExe>
<_TestRunnerCommand>"$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\net452\$(_XUnitConsoleExe)" "$(TargetPath)" -verbose -xml "$(_TestLogPath)"</_TestRunnerCommand>
</PropertyGroup>
<MakeDir Directories="$(ArtifactsTestResultsDir)"/>
<Delete Files="$(_TestOutPathNoExt)" />
<Delete Files="$(_TestStdOutPath)" />
<Message Text="Running tests: $(TargetPath) [$(_TestEnvironment)]" Importance="high"/>
<Exec Command='$(_TestRunnerCommand) > $(_TestStdOutPath)'
LogStandardErrorAsError="false"
WorkingDirectory="$(OutDir)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="_TestErrorCode" />
</Exec>
<WriteLinesToFile File="$(_TestStdOutPath)" Overwrite="false" Lines=";=== COMMAND LINE ===;$(_TestRunnerCommand)" />
<ItemGroup>
<_FailedTestRuns Include="$(_TestEnvironment)" Condition="'$(_TestErrorCode)' != '0'" />
</ItemGroup>
<PropertyGroup>
<_TestResultMessage Condition="'$(_TestErrorCode)' == '0'">Tests succeeded: $(TargetPath) [$(_TestEnvironment)]</_TestResultMessage>
<_TestResultMessage Condition="'$(_TestErrorCode)' != '0'">Tests failed: $(TargetPath) [$(_TestEnvironment)]; $(_TestStdOutPath)</_TestResultMessage>
</PropertyGroup>
<Message Text="$(_TestResultMessage)" Condition="'$(_TestErrorCode)' == '0'" Importance="high"/>
<Warning Text="$(_TestResultMessage)" Condition="'$(_TestErrorCode)' != '0' and '$(TargetFrameworks)' != ''" />
<Error Text="$(_TestResultMessage)" Condition="'$(_TestErrorCode)' != '0' and '$(TargetFrameworks)' == ''" />
</Target>
<Target Name="OuterTest" Returns="@(InnerOutput)">
<ItemGroup>
<_TargetFramework Include="$(TargetFrameworks)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)"
Condition="'$(TargetFrameworks)' != '' "
Targets="InnerTest"
Properties="TargetFramework=%(_TargetFramework.Identity)">
<Output ItemName="_FailedTestRuns" TaskParameter="TargetOutputs" />
</MSBuild>
<Error Text="Tests failed on platforms: @(_FailedTestRuns, ', ')" Condition="'@(_FailedTestRuns)' != ''" />
</Target>
<!--
In order to leverage LUT testing we need to have both of the following packages in
our build.
- xunit.runner.desktop
- xunit
Both of these include xunit.abstractions.dll in different forms: content and reference
respectively. This creates a double write violation in our build. The content item
is unnecessary for us since we reference the xunit package hence remove it here.
https://github.com/dotnet/roslyn/issues/18753
-->
<Target Name="RemoveDuplicateXUnitContent">
<ItemGroup>
<Content Remove="@(Content)" Condition="'%(Filename)%(Extension)' == 'xunit.abstractions.dll'" />
</ItemGroup>
</Target>
<PropertyGroup>
<PrepareForBuildDependsOn>RemoveDuplicateXUnitContent;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,3 @@
{
"shadowCopy": false
}

Просмотреть файл

@ -20,7 +20,6 @@ namespace VsixExpInstaller
private const int GLOBAL_UNINSTALL_FAILED_EXCEPTION_CODE = -4;
private const int LOCAL_UNINSTALL_FAILED_EXCEPTION_CODE = -5;
private const int E_ACCESSDENIED = -2147024891; // 0x80070005
private const int MANAGED_EXCEPTION_CODE_V4 = -532462766; // 0xE0434352
private const string ExtensionManagerCollectionPath = "ExtensionManager";
@ -416,13 +415,8 @@ namespace VsixExpInstaller
}
}
}
catch (Exception e)
catch (Exception e) when (Environment.ExitCode != 0)
{
if (Environment.ExitCode == 0)
{
Environment.ExitCode = MANAGED_EXCEPTION_CODE_V4;
}
if (Environment.ExitCode < 0)
{
Console.Error.WriteLine(e);