From 5280e6f859fa98b1aefcc2c69946bdcadaff71ea Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Fri, 14 Jul 2017 16:46:00 -0700 Subject: [PATCH] RepoToolset v21 --- src/NuGet/RepoToolset.nuspec | 2 +- src/RepoToolset/Build.proj | 78 +++++--- src/RepoToolset/Compiler.props | 26 --- src/RepoToolset/DefaultVersions.props | 30 +++ .../GenerateInternalsVisibleTo.targets | 43 ++-- src/RepoToolset/GenerateResxSource.csx | 138 +++++++++++-- src/RepoToolset/GenerateResxSource.targets | 12 +- src/RepoToolset/Imports.targets | 26 +-- src/RepoToolset/Localization.props | 14 ++ src/RepoToolset/MSFT.snk | Bin 0 -> 160 bytes src/RepoToolset/NuGet.config | 9 + src/RepoToolset/OptimizationData.targets | 32 +++ src/RepoToolset/ProjectDefaults.props | 50 ++++- src/RepoToolset/RepoLayout.props | 3 + src/RepoToolset/Settings.props | 11 +- src/RepoToolset/Sign.proj | 3 +- src/RepoToolset/SourceLink.props | 13 ++ src/RepoToolset/StrongName.props | 7 + src/RepoToolset/StrongName.targets | 48 +++-- src/RepoToolset/Test.props | 21 -- src/RepoToolset/Test.targets | 74 ------- src/RepoToolset/Tests.props | 25 +++ src/RepoToolset/Tools.proj | 16 ++ src/RepoToolset/Tools.props | 6 + src/RepoToolset/Version.props | 8 +- .../VisualStudio.ImportSdk.targets | 3 + .../VisualStudio.Insertion.Pack.proj | 72 +++++++ src/RepoToolset/VisualStudio.Pack.proj | 41 ---- .../VisualStudio.SetupPackage.swixproj | 37 ++++ .../VisualStudio.SetupPackage.vsmanproj | 25 +-- src/RepoToolset/VisualStudio.props | 24 ++- src/RepoToolset/VisualStudio.targets | 187 +++++++++++++++--- src/RepoToolset/Workarounds.targets | 73 +++++++ src/RepoToolset/XUnit.props | 25 +++ src/RepoToolset/XUnit.targets | 113 +++++++++++ src/RepoToolset/xunit.runner.json | 3 + .../VSIXExpInstaller/Program.cs | 8 +- 37 files changed, 966 insertions(+), 340 deletions(-) delete mode 100644 src/RepoToolset/Compiler.props create mode 100644 src/RepoToolset/DefaultVersions.props create mode 100644 src/RepoToolset/Localization.props create mode 100644 src/RepoToolset/MSFT.snk create mode 100644 src/RepoToolset/NuGet.config create mode 100644 src/RepoToolset/OptimizationData.targets create mode 100644 src/RepoToolset/SourceLink.props create mode 100644 src/RepoToolset/StrongName.props delete mode 100644 src/RepoToolset/Test.props delete mode 100644 src/RepoToolset/Test.targets create mode 100644 src/RepoToolset/Tests.props create mode 100644 src/RepoToolset/Tools.proj create mode 100644 src/RepoToolset/Tools.props create mode 100644 src/RepoToolset/VisualStudio.ImportSdk.targets create mode 100644 src/RepoToolset/VisualStudio.Insertion.Pack.proj delete mode 100644 src/RepoToolset/VisualStudio.Pack.proj create mode 100644 src/RepoToolset/VisualStudio.SetupPackage.swixproj create mode 100644 src/RepoToolset/Workarounds.targets create mode 100644 src/RepoToolset/XUnit.props create mode 100644 src/RepoToolset/XUnit.targets create mode 100644 src/RepoToolset/xunit.runner.json diff --git a/src/NuGet/RepoToolset.nuspec b/src/NuGet/RepoToolset.nuspec index 5f18f3dc..96b0c4b7 100644 --- a/src/NuGet/RepoToolset.nuspec +++ b/src/NuGet/RepoToolset.nuspec @@ -8,7 +8,7 @@ en-US true - 1.0.0-alpha20 + 1.0.0-alpha21 Microsoft http://go.microsoft.com/fwlink/?LinkId=529443 Repository Toolset MSBuild SDK diff --git a/src/RepoToolset/Build.proj b/src/RepoToolset/Build.proj index 00314a05..d9bb4b8f 100644 --- a/src/RepoToolset/Build.proj +++ b/src/RepoToolset/Build.proj @@ -1,26 +1,29 @@ - + + - + <_DirectoryBuildPropsFile>Directory.Build.props <_DirectoryBuildPropsBasePath>$([MSBuild]::GetDirectoryNameOfFileAbove('$(SolutionPath)', '$(_DirectoryBuildPropsFile)')) @@ -29,37 +32,43 @@ + - - <_DotNetDlls Include="$(DotNetRoot)sdk\**\dotnet.dll" /> - - - - - Debug - $(Properties);Configuration=$(Configuration);CIBuild=$(CIBuild) + $(Properties);Configuration=$(Configuration);CIBuild=$(CIBuild);__DeployProjectOutput=$(Deploy) - > - + + + + - + + - - + + Condition="'$(Pack)' == 'true' and '$(UsingToolVSSDK)' == 'true'"/> - + \ No newline at end of file diff --git a/src/RepoToolset/Compiler.props b/src/RepoToolset/Compiler.props deleted file mode 100644 index 7313d853..00000000 --- a/src/RepoToolset/Compiler.props +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - $(NuGetPackageRoot)Microsoft.Net.Compilers\$(MicrosoftNetCompilersVersion)\ - $(ToolsetCompilerPackageDir)build\Microsoft.Net.Compilers.props - - - - - - - - - - \ No newline at end of file diff --git a/src/RepoToolset/DefaultVersions.props b/src/RepoToolset/DefaultVersions.props new file mode 100644 index 00000000..2b5e1bb4 --- /dev/null +++ b/src/RepoToolset/DefaultVersions.props @@ -0,0 +1,30 @@ + + + + + + true + true + true + + + false + false + + + 0.2.0-beta-000051 + 2.2.0-b491 + 2.3.0-beta3-build3705 + 15.1.192 + 1.0.147 + 4.7.1-alpha-00001 + 0.3.3-beta + 0.2.0 + 2.3.0-beta3-build3705 + 15.3.0-preview-20170628-02 + 2.3.0-beta4-61908-01 + 0.2.4-beta + + \ No newline at end of file diff --git a/src/RepoToolset/GenerateInternalsVisibleTo.targets b/src/RepoToolset/GenerateInternalsVisibleTo.targets index 2630c8ba..525163f3 100644 --- a/src/RepoToolset/GenerateInternalsVisibleTo.targets +++ b/src/RepoToolset/GenerateInternalsVisibleTo.targets @@ -10,42 +10,27 @@ - - , PublicKey=$(PublicKey) - + + + <_InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute"> + <_Parameter1 Condition="'%(InternalsVisibleTo.Key)' != ''">%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.Key) + <_Parameter1 Condition="'%(InternalsVisibleTo.Key)' == ''">%(InternalsVisibleTo.Identity), PublicKey=$(PublicKey) + + + - + - - - - - - diff --git a/src/RepoToolset/GenerateResxSource.csx b/src/RepoToolset/GenerateResxSource.csx index f5f286af..d8b55654 100644 --- a/src/RepoToolset/GenerateResxSource.csx +++ b/src/RepoToolset/GenerateResxSource.csx @@ -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 ? $@"// -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 ? +$@"' +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); diff --git a/src/RepoToolset/GenerateResxSource.targets b/src/RepoToolset/GenerateResxSource.targets index 1c86d4b5..0f0c3364 100644 --- a/src/RepoToolset/GenerateResxSource.targets +++ b/src/RepoToolset/GenerateResxSource.targets @@ -31,16 +31,20 @@ Inputs="@(EmbeddedResourceSG)" Outputs="%(EmbeddedResourceSG.SourceOutputPath)"> - + + + <_EmbeddedResourceSourceExtension Condition="'$(Language)' == 'C#'">cs + <_EmbeddedResourceSourceExtension Condition="'$(Language)' == 'VB'">vb + + - - $(IntermediateOutputPath)%(EmbeddedResourceSG.ManifestResourceName).cs + $(IntermediateOutputPath)%(EmbeddedResourceSG.ManifestResourceName).$(_EmbeddedResourceSourceExtension) - + \ No newline at end of file diff --git a/src/RepoToolset/Imports.targets b/src/RepoToolset/Imports.targets index bff7d536..37cff2b0 100644 --- a/src/RepoToolset/Imports.targets +++ b/src/RepoToolset/Imports.targets @@ -1,25 +1,25 @@ - + + + $(__DeployProjectOutput) + + + + + - + - - - - - true - - + + + - + \ No newline at end of file diff --git a/src/RepoToolset/Localization.props b/src/RepoToolset/Localization.props new file mode 100644 index 00000000..11dd845f --- /dev/null +++ b/src/RepoToolset/Localization.props @@ -0,0 +1,14 @@ + + + + + true + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/MSFT.snk b/src/RepoToolset/MSFT.snk new file mode 100644 index 0000000000000000000000000000000000000000..110b59c7b0d27388353dcf4116f721595f473e58 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa500968(fU`!uG#RTE`+KN zuKf+^=>2N!kB9pMc5H)8nUWr|JLj6&)!f0|n$k8CAp(#KayILlN=pn$R@96PlTucm;!K;}lU1BV%Wh@=~);)AxZ!P8VeqOH+#FjlK9EuV{ OWf&lBz>_phTGEsG5JRQ_ literal 0 HcmV?d00001 diff --git a/src/RepoToolset/NuGet.config b/src/RepoToolset/NuGet.config new file mode 100644 index 00000000..b5bc2914 --- /dev/null +++ b/src/RepoToolset/NuGet.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/RepoToolset/OptimizationData.targets b/src/RepoToolset/OptimizationData.targets new file mode 100644 index 00000000..e3f952bb --- /dev/null +++ b/src/RepoToolset/OptimizationData.targets @@ -0,0 +1,32 @@ + + + + + <_OptimizationDataFile>$([System.IO.Path]::GetFullPath('$(IbcOptimizationDataDir)$(TargetName).pgo')) + + + + + + <_RunIbc>false + <_RunIbc Condition="'$(Configuration)' == 'Release' and '$(OfficialBuild)' == 'true'">true + + <_IbcMergePath>$(NuGetPackageRoot)\Microsoft.DotNet.IBCMerge\$(MicrosoftDotNetIBCMergeVersion)\lib\net45\ibcmerge.exe + <_IbcMergeCommandLineArgs>-q -f -partialNGEN -minify -mo "@(IntermediateAssembly)" -incremental "$(_OptimizationDataFile)" + + + + + + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/ProjectDefaults.props b/src/RepoToolset/ProjectDefaults.props index 8f0b75de..0abd2073 100644 --- a/src/RepoToolset/ProjectDefaults.props +++ b/src/RepoToolset/ProjectDefaults.props @@ -1,7 +1,8 @@ - + true + MicrosoftShared true en-US Microsoft Corporation @@ -20,11 +21,52 @@ https://github.com/Microsoft/msbuild/issues/2202 --> false + + + false + + + IOperation,$(Features) + + C# + VB + + + + + + + + + C# + $(MSBuildToolsPath)\Microsoft.CSharp.targets + + + + + VB + $(MSBuildToolsPath)\Microsoft.VisualBasic.targets + + + + + + + + - + true $(NoWarn);1591 @@ -44,7 +86,7 @@ - + Empty Binary @@ -57,12 +99,14 @@ true + full true true true + full true diff --git a/src/RepoToolset/RepoLayout.props b/src/RepoToolset/RepoLayout.props index 91711d45..fcb53853 100644 --- a/src/RepoToolset/RepoLayout.props +++ b/src/RepoToolset/RepoLayout.props @@ -10,8 +10,11 @@ $(RepoRoot)artifacts\ $(ArtifactsDir)$(Configuration)\bin\ $(ArtifactsDir)$(Configuration)\obj\ + $(ArtifactsDir)toolset\ $(ArtifactsDir)$(Configuration)\TestResults\ $(ArtifactsDir)$(Configuration)\packages\ $(ArtifactsDir)$(Configuration)\VSSetup\ + $(VisualStudioSetupOutputPath)Insertion\ + $(ArtifactsDir)$(Configuration)\VSSetup.obj\ \ No newline at end of file diff --git a/src/RepoToolset/Settings.props b/src/RepoToolset/Settings.props index c6415db1..bbd2e28d 100644 --- a/src/RepoToolset/Settings.props +++ b/src/RepoToolset/Settings.props @@ -1,8 +1,15 @@  + - + - + + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/Sign.proj b/src/RepoToolset/Sign.proj index 7da26212..da78eea3 100644 --- a/src/RepoToolset/Sign.proj +++ b/src/RepoToolset/Sign.proj @@ -8,7 +8,8 @@ - + + diff --git a/src/RepoToolset/SourceLink.props b/src/RepoToolset/SourceLink.props new file mode 100644 index 00000000..95adca79 --- /dev/null +++ b/src/RepoToolset/SourceLink.props @@ -0,0 +1,13 @@ + + + + + true + + $(RepoRoot) + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/StrongName.props b/src/RepoToolset/StrongName.props new file mode 100644 index 00000000..ba48a4d9 --- /dev/null +++ b/src/RepoToolset/StrongName.props @@ -0,0 +1,7 @@ + + + + 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9 + 002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293 + + \ No newline at end of file diff --git a/src/RepoToolset/StrongName.targets b/src/RepoToolset/StrongName.targets index 81010c70..afadd5a1 100644 --- a/src/RepoToolset/StrongName.targets +++ b/src/RepoToolset/StrongName.targets @@ -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 --> - - - - - true - false - - + + + true + false + + - - - false - true - - - + + + false + true + + + - - + + + + + $(MSBuildThisFileDirectory)MSFT.snk + $(MicrosoftPublicKey) + b03f5f7f11d50a3a + + + + $(MSBuildThisFileDirectory)35MSSharedLib1024.snk - 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9 + $(MicrosoftSharedPublicKey) 31BF3856AD364E35 @@ -63,5 +71,9 @@ + + \ No newline at end of file diff --git a/src/RepoToolset/Test.props b/src/RepoToolset/Test.props deleted file mode 100644 index 684d1378..00000000 --- a/src/RepoToolset/Test.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - true - - - - - - - - - - - - - - PreserveNewest - - - \ No newline at end of file diff --git a/src/RepoToolset/Test.targets b/src/RepoToolset/Test.targets deleted file mode 100644 index 0dbb32a6..00000000 --- a/src/RepoToolset/Test.targets +++ /dev/null @@ -1,74 +0,0 @@ - - - - x64 - true - <_TestTargetName Condition="'$(TargetFrameworks)' == ''">InnerTest - <_TestTargetName Condition="'$(TargetFrameworks)' != ''">OuterTest - <_TestUsingDotNetCli>false - <_TestUsingDotNetCli Condition="Exists('$(DotNetTool)')">true - - - - - - <_TestArchitectureItems Include="$(TestArchitectures)" /> - - - - - - - - <_TestArchitecture>%(_TestArchitectureItems.Identity) - <_TestEnvironment>$(TargetFramework)|$(_TestArchitecture) - <_TestOutPathNoExt>$(ArtifactsTestResultsDir)$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture) - <_TestStdOutPath>$(_TestOutPathNoExt).log - <_TestLogPath>$(_TestOutPathNoExt).xml - - - - <_TestLogger>xunit;LogFilePath="$(_TestLogPath)";Environment="$(_TestEnvironment)";XUnitVersion="$(XUnitVersion)" - <_TestRunnerCommand>"$(DotNetTool)" test "$(MSBuildProjectFullPath)" --no-build --framework:$(TargetFramework) --configuration:$(Configuration) --logger:$(_TestLogger) -- --platform:$(_TestArchitecture) - - - - <_XUnitConsoleExe>xunit.console.exe - <_XUnitConsoleExe Condition="'$(_TestArchitecture)' == 'x86'">xunit.console.x86.exe - <_TestRunnerCommand>"$(NuGetPackageRoot)xunit.runner.console\$(XUnitRunnerConsoleVersion)\tools\$(_XUnitConsoleExe)" "$(TargetPath)" -verbose -xml "$(_TestLogPath)" - - - - - - - - - - - - - <_FailedTestRuns Include="$(_TestEnvironment)" Condition="'$(_TestErrorCode)' != '0'" /> - - - - - - - - - <_TargetFramework Include="$(TargetFrameworks)" /> - - - - - - - - \ No newline at end of file diff --git a/src/RepoToolset/Tests.props b/src/RepoToolset/Tests.props new file mode 100644 index 00000000..44170b10 --- /dev/null +++ b/src/RepoToolset/Tests.props @@ -0,0 +1,25 @@ + + + + false + true + + + + false + true + + + + false + true + + + false + + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/Tools.proj b/src/RepoToolset/Tools.proj new file mode 100644 index 00000000..56ae6b80 --- /dev/null +++ b/src/RepoToolset/Tools.proj @@ -0,0 +1,16 @@ + + + + + net462 + + + + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/Tools.props b/src/RepoToolset/Tools.props new file mode 100644 index 00000000..9087e903 --- /dev/null +++ b/src/RepoToolset/Tools.props @@ -0,0 +1,6 @@ + + + + $(NuGetPackageRoot)Microsoft.Net.Compilers\$(MicrosoftNetCompilersVersion)\ + + \ No newline at end of file diff --git a/src/RepoToolset/Version.props b/src/RepoToolset/Version.props index bc018771..a880a676 100644 --- a/src/RepoToolset/Version.props +++ b/src/RepoToolset/Version.props @@ -21,14 +21,16 @@ --> - - $(VersionBase).0 + false + true + + - + <_BuildNumberFiveDigitDateStamp>$([MSBuild]::Subtract($(BUILD_BUILDNUMBER.Split('.')[0].Substring(3).Trim()), 8800)) <_BuildNumberBuildOfTheDayPadded>$(BUILD_BUILDNUMBER.Split('.')[1].PadLeft(2,'0')) diff --git a/src/RepoToolset/VisualStudio.ImportSdk.targets b/src/RepoToolset/VisualStudio.ImportSdk.targets new file mode 100644 index 00000000..7f32c2ef --- /dev/null +++ b/src/RepoToolset/VisualStudio.ImportSdk.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/RepoToolset/VisualStudio.Insertion.Pack.proj b/src/RepoToolset/VisualStudio.Insertion.Pack.proj new file mode 100644 index 00000000..85578327 --- /dev/null +++ b/src/RepoToolset/VisualStudio.Insertion.Pack.proj @@ -0,0 +1,72 @@ + + + + + + + + + + <_StubFiles Include="$(VisualStudioSetupIntermediateOutputPath)**\*.stub"/> + <_StubDirs Include="@(_StubFiles->'%(RecursiveDir)')"/> + + + + + + + + + + <_VsixFileName>@(_StubLines) + <_JsonFileName>%(_StubFiles.FileName).json + <_RemoveExperimentalFlag>false + <_RemoveExperimentalFlag Condition="Exists('$(VisualStudioSetupOutputPath)$(_VsixFileName)')">true + + + + + + + + <_ModifyVsixManifestToolExe>$(NuGetPackageRoot)\RoslynTools.Microsoft.ModifyVsixManifest\$(RoslynToolsMicrosoftModifyVsixManifestVersion)\tools\ModifyVsixManifest.exe + <_ModifyVsixManifestArgs>--remove=//x:PackageManifest/x:Installation/@Experimental --add-attribute=//x:PackageManifest/x:Installation;SystemComponent;true + + + + + + + + + + + + <_ComponentDir>%(_StubDirs.Identity) + <_ComponentName>$(_ComponentDir.TrimEnd('\')) + + + + <_Args Include="ComponentName=$(_ComponentName)"/> + <_Args Include="SetupOutputPath=$(VisualStudioSetupInsertionPath)"/> + <_Args Include="ComponentIntermediateOutputPath=$(VisualStudioSetupIntermediateOutputPath)$(_ComponentName)\"/> + <_Args Include="MicroBuildPath=$(NuGetPackageRoot)MicroBuild.Core\$(MicroBuildCoreVersion)\"/> + + + + + + + + + diff --git a/src/RepoToolset/VisualStudio.Pack.proj b/src/RepoToolset/VisualStudio.Pack.proj deleted file mode 100644 index 48aed9cb..00000000 --- a/src/RepoToolset/VisualStudio.Pack.proj +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - <_VisualStudioSetupComponents Include="$(VisualStudioSetupOutputPath)**\*.json"/> - - - - - - - <_ComponentDir>%(_VisualStudioSetupComponents.RecursiveDir) - <_ComponentName>%(_VisualStudioSetupComponents.Filename) - <_SetupIntermediateOutputPath>$(ArtifactsDir)$(Configuration)\VSSetup.obj\$(_ComponentDir) - <_ComponentProj>$(_SetupIntermediateOutputPath)\$(_ComponentName).vsmanproj - - - - <_Args Include="SetupOutputPath=$(VisualStudioSetupOutputPath)$(_ComponentDir)"/> - <_Args Include="SetupIntermediateOutputPath=$(_SetupIntermediateOutputPath)"/> - <_Args Include="MicroBuildPath=$(NuGetPackageRoot)MicroBuild.Core\$(MicroBuildCoreVersion)\"/> - - - - - - - - - diff --git a/src/RepoToolset/VisualStudio.SetupPackage.swixproj b/src/RepoToolset/VisualStudio.SetupPackage.swixproj new file mode 100644 index 00000000..a357a493 --- /dev/null +++ b/src/RepoToolset/VisualStudio.SetupPackage.swixproj @@ -0,0 +1,37 @@ + + + + + + v4.6 + neutral + false + vsix + true + $(SwrPackageName) + + + + + + <_SwrProperties Include="$([MSBuild]::Unescape($(SwrProperties)))" /> + + + + $(PackagePreprocessorDefinitions);@(_SwrProperties) + $(IntermediateOutputPath) + + + + + + + + \ No newline at end of file diff --git a/src/RepoToolset/VisualStudio.SetupPackage.vsmanproj b/src/RepoToolset/VisualStudio.SetupPackage.vsmanproj index 45605199..c7c741bb 100644 --- a/src/RepoToolset/VisualStudio.SetupPackage.vsmanproj +++ b/src/RepoToolset/VisualStudio.SetupPackage.vsmanproj @@ -1,12 +1,13 @@ - + - + false false @@ -20,17 +21,19 @@ true true v4.6 + $(ComponentName) $(SetupOutputPath) - $(SetupIntermediateOutputPath) + $(ComponentIntermediateOutputPath) - + + + <_PackageStubFiles Include="$(ComponentIntermediateOutputPath)*.stub"/> + + + false - - - - diff --git a/src/RepoToolset/VisualStudio.props b/src/RepoToolset/VisualStudio.props index a6156740..54423c9b 100644 --- a/src/RepoToolset/VisualStudio.props +++ b/src/RepoToolset/VisualStudio.props @@ -1,18 +1,30 @@ + - - - - true - false + $(MSBuildProjectDirectory)\source.extension.vsixmanifest + false + true + + + + + + + + false + Program $(DevEnvDir)devenv.exe /rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log - true + true true All 3 + + + true + \ No newline at end of file diff --git a/src/RepoToolset/VisualStudio.targets b/src/RepoToolset/VisualStudio.targets index 701401a8..de159830 100644 --- a/src/RepoToolset/VisualStudio.targets +++ b/src/RepoToolset/VisualStudio.targets @@ -1,12 +1,135 @@ + + + + + + <_TargetVsixContainerDir>$(VisualStudioSetupOutputPath) + + $(TargetName).vsix + $(_TargetVsixContainerDir)$(TargetVsixContainerName) + + false + true + + <_ComponentIntermediateDir Condition="'$(VisualStudioInsertionComponent)' != ''">$(VisualStudioSetupIntermediateOutputPath)$(VisualStudioInsertionComponent)\ + + - + Read package id from the extension.vsixmanifest file. VS SDK doesn't expose this value in any msbuild property. + --> + + + <_VsxXmlNamespace><Namespace Prefix='vsx' Uri='http://schemas.microsoft.com/developer/vsx-schema/2011'/> + + + + + + + + + + + + + + <_PackageStubFile>$(_ComponentIntermediateDir)$(_VsixPackageId).stub + + + + + + + + + + + + + + + + + + + + + + + + + + <_SwixNugets Include="$(NuGetPackageRoot)MicroBuild.Plugins.swixbuild\**\*.nupkg"/> + + + + + + + + + + <_SwrProperties>@(SwrProperty) + <_SwrFiles>@(SwrFile->'%(FullPath)') + + + <_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)\"/> + + + + + + + + + + + + + + + <_PackageStubFile>$(_ComponentIntermediateDir)$(TargetName).stub + + - <_VsixPayload Include="$(OutputPath)$(VsixPackageId).json" /> - - - <_VsixPayload Include="$(OutputPath)$(MSBuildProjectName).vsix" /> - - - - - - + + + + + + + + + + + %(IntermediateZipItem.Filename)\%(IntermediateZipItem.Language)\%(IntermediateZipItem.OutputSubPath)\%(IntermediateZipItem.Culture) + + + %(IntermediateZipProject.Filename)\%(IntermediateZipProject.Language)\%(IntermediateZipProject.OutputSubPath)\%(IntermediateZipProject.Culture) + + - - - - + + $(GetVsixSourceItemsDependsOn);GetVsixTemplateItems + + - + \ No newline at end of file diff --git a/src/RepoToolset/Workarounds.targets b/src/RepoToolset/Workarounds.targets new file mode 100644 index 00000000..2249548b --- /dev/null +++ b/src/RepoToolset/Workarounds.targets @@ -0,0 +1,73 @@ + + + + + + + true + + + + + + + false + + + + + + + + + + + + + + + + $([System.IO.Directory]::GetParent(%(ResourceCopyLocalItems.FullPath)).get_Name())\ + + + + + + + + + + + + + <_GenerateBindingRedirectsIntermediateAppConfig>$(IntermediateOutputPath)$(TargetFileName).config + + + \ No newline at end of file diff --git a/src/RepoToolset/XUnit.props b/src/RepoToolset/XUnit.props new file mode 100644 index 00000000..442371f0 --- /dev/null +++ b/src/RepoToolset/XUnit.props @@ -0,0 +1,25 @@ + + + + <_DotNetCliToolExists>false + <_DotNetCliToolExists Condition="Exists('$(DotNetTool)')">true + + $(_DotNetCliToolExists) + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + \ No newline at end of file diff --git a/src/RepoToolset/XUnit.targets b/src/RepoToolset/XUnit.targets new file mode 100644 index 00000000..dd278079 --- /dev/null +++ b/src/RepoToolset/XUnit.targets @@ -0,0 +1,113 @@ + + + + true + <_TestTargetName Condition="'$(TargetFrameworks)' == ''">InnerTest + <_TestTargetName Condition="'$(TargetFrameworks)' != ''">OuterTest + + + + $(PlatformTarget) + x64 + + + + + + + <_TestArchitectureItems Include="$(TestArchitectures)" /> + + + + + + + <_TestArchitecture>%(_TestArchitectureItems.Identity) + <_TestEnvironment>$(TargetFramework)|$(_TestArchitecture) + <_TestOutPathNoExt>$(ArtifactsTestResultsDir)$(MSBuildProjectName)_$(TargetFramework)_$(_TestArchitecture) + <_TestStdOutPath>$(_TestOutPathNoExt).log + <_TestLogPath>$(_TestOutPathNoExt).xml + <_TargetFileNameNoExt>$([System.IO.Path]::GetFileNameWithoutExtension('$(TargetFileName)')) + <_CoreRuntimeConfigPath>$(TargetDir)$(_TargetFileNameNoExt).runtimeconfig.json + <_CoreDepsPath>$(TargetDir)$(_TargetFileNameNoExt).deps.json + <_RunOnCore>false + <_RunOnCore Condition="'$(TestUsingDotNetCli)' == 'true' and $(TargetFramework.StartsWith('netcoreapp'))">true + + + + <_TestRunnerCommand>"$(DotNetTool)" exec --depsfile "$(_CoreDepsPath)" --runtimeconfig "$(_CoreRuntimeConfigPath)" "$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\netcoreapp1.0\xunit.console.dll" "$(TargetPath)" -noautoreporters -xml "$(_TestLogPath)" + + + + <_XUnitConsoleExe>xunit.console.exe + <_XUnitConsoleExe Condition="'$(_TestArchitecture)' == 'x86'">xunit.console.x86.exe + <_TestRunnerCommand>"$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\net452\$(_XUnitConsoleExe)" "$(TargetPath)" -verbose -xml "$(_TestLogPath)" + + + + + + + + + + + + + + + + + <_FailedTestRuns Include="$(_TestEnvironment)" Condition="'$(_TestErrorCode)' != '0'" /> + + + + <_TestResultMessage Condition="'$(_TestErrorCode)' == '0'">Tests succeeded: $(TargetPath) [$(_TestEnvironment)] + <_TestResultMessage Condition="'$(_TestErrorCode)' != '0'">Tests failed: $(TargetPath) [$(_TestEnvironment)]; $(_TestStdOutPath) + + + + + + + + + + <_TargetFramework Include="$(TargetFrameworks)" /> + + + + + + + + + + + + + + + + + RemoveDuplicateXUnitContent;$(PrepareForBuildDependsOn) + + \ No newline at end of file diff --git a/src/RepoToolset/xunit.runner.json b/src/RepoToolset/xunit.runner.json new file mode 100644 index 00000000..78c070e8 --- /dev/null +++ b/src/RepoToolset/xunit.runner.json @@ -0,0 +1,3 @@ +{ + "shadowCopy": false +} \ No newline at end of file diff --git a/src/VSIXExpInstaller/VSIXExpInstaller/Program.cs b/src/VSIXExpInstaller/VSIXExpInstaller/Program.cs index d29a41cf..f0c7cc85 100644 --- a/src/VSIXExpInstaller/VSIXExpInstaller/Program.cs +++ b/src/VSIXExpInstaller/VSIXExpInstaller/Program.cs @@ -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);