Skip to content

Commit 027ee0b

Browse files
authored
Generate VSMSBuildExtension package in join point (#44288)
1 parent 9c7d1ae commit 027ee0b

File tree

12 files changed

+114
-162
lines changed

12 files changed

+114
-162
lines changed

eng/Build.props

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
<ProjectToBuild Include="$(RepoRoot)src/VirtualMonoRepo/InitializeVMR.proj" BuildInParallel="false" />
77
</ItemGroup>
88

9-
<ItemGroup Condition="'$(DotNetBuildPass)' != '' and '$(DotNetBuildPass)' != '1'">
10-
<!-- For product build, build SdkResolver and VSTemplateLocator only in the second build pass as they depend on
11-
assets from other verticals that are built in the first build pass. -->
12-
<ProjectToBuild Include="$(RepoRoot)src\Installer\redist-installer\projects\SdkResolver.csproj" DotNetBuildPass="2" />
9+
<!-- For product build, build MSBuildExtensions and VSTemplateLocator only in the second build pass on win-x64 as
10+
they depend on assets from other verticals that are built in the first build pass. -->
11+
<ItemGroup Condition="'$(DotNetBuildPass)' == '2' and
12+
'$(OS)' == 'Windows_NT' and
13+
'$(Architecture)' == 'x64'">
14+
<ProjectToBuild Include="$(RepoRoot)src\Installer\redist-installer\projects\VSMSBuildExtensions\VSMSBuildExtensions.csproj" DotNetBuildPass="2" />
1315
<ProjectToBuild Include="$(RepoRoot)src\Installer\redist-installer\projects\VSTemplateLocator\VSTemplateLocator.csproj" DotNetBuildPass="2" />
1416
</ItemGroup>
1517

sdk.sln

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "finalizer-build", "src\Inst
499499
EndProject
500500
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "redist-installer", "src\Installer\redist-installer\redist-installer.csproj", "{FAADC193-BA41-449D-97CE-0EF82836046A}"
501501
EndProject
502-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SdkResolver", "src\Installer\redist-installer\projects\SdkResolver.csproj", "{27E399C0-6F91-45D6-A63D-041DA41CCFDF}"
503-
EndProject
504502
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VSTemplateLocator", "src\Installer\redist-installer\projects\VSTemplateLocator\VSTemplateLocator.csproj", "{0CBA5FB8-71A3-457A-89F3-E52B9602164A}"
505503
EndProject
506504
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "core-sdk-tasks.Tests", "test\core-sdk-tasks.Tests\core-sdk-tasks.Tests.csproj", "{21C21975-84C1-4A24-8E21-F7EC790A4584}"
@@ -513,6 +511,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Sdk.Compilers
513511
EndProject
514512
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WebTools.AspireService.Tests", "test\Microsoft.WebTools.AspireService.Tests\Microsoft.WebTools.AspireService.Tests.csproj", "{1F0B4B3C-DC88-4740-B04F-1707102E9930}"
515513
EndProject
514+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSMSBuildExtensions", "src\Installer\redist-installer\projects\VSMSBuildExtensions\VSMSBuildExtensions.csproj", "{D9617F63-15F4-4CA2-8ECF-728A94B45D82}"
515+
EndProject
516516
Global
517517
GlobalSection(SolutionConfigurationPlatforms) = preSolution
518518
Debug|Any CPU = Debug|Any CPU
@@ -947,10 +947,6 @@ Global
947947
{FAADC193-BA41-449D-97CE-0EF82836046A}.Debug|Any CPU.Build.0 = Debug|Any CPU
948948
{FAADC193-BA41-449D-97CE-0EF82836046A}.Release|Any CPU.ActiveCfg = Release|Any CPU
949949
{FAADC193-BA41-449D-97CE-0EF82836046A}.Release|Any CPU.Build.0 = Release|Any CPU
950-
{27E399C0-6F91-45D6-A63D-041DA41CCFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
951-
{27E399C0-6F91-45D6-A63D-041DA41CCFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
952-
{27E399C0-6F91-45D6-A63D-041DA41CCFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
953-
{27E399C0-6F91-45D6-A63D-041DA41CCFDF}.Release|Any CPU.Build.0 = Release|Any CPU
954950
{0CBA5FB8-71A3-457A-89F3-E52B9602164A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
955951
{0CBA5FB8-71A3-457A-89F3-E52B9602164A}.Debug|Any CPU.Build.0 = Debug|Any CPU
956952
{0CBA5FB8-71A3-457A-89F3-E52B9602164A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -971,6 +967,10 @@ Global
971967
{1F0B4B3C-DC88-4740-B04F-1707102E9930}.Debug|Any CPU.Build.0 = Debug|Any CPU
972968
{1F0B4B3C-DC88-4740-B04F-1707102E9930}.Release|Any CPU.ActiveCfg = Release|Any CPU
973969
{1F0B4B3C-DC88-4740-B04F-1707102E9930}.Release|Any CPU.Build.0 = Release|Any CPU
970+
{D9617F63-15F4-4CA2-8ECF-728A94B45D82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
971+
{D9617F63-15F4-4CA2-8ECF-728A94B45D82}.Debug|Any CPU.Build.0 = Debug|Any CPU
972+
{D9617F63-15F4-4CA2-8ECF-728A94B45D82}.Release|Any CPU.ActiveCfg = Release|Any CPU
973+
{D9617F63-15F4-4CA2-8ECF-728A94B45D82}.Release|Any CPU.Build.0 = Release|Any CPU
974974
EndGlobalSection
975975
GlobalSection(SolutionProperties) = preSolution
976976
HideSolutionNode = FALSE
@@ -1142,13 +1142,13 @@ Global
11421142
{5593C59B-442B-4783-8527-74F6E41668D9} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
11431143
{32DA04FF-A951-43EA-B2FA-86A825009A97} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
11441144
{FAADC193-BA41-449D-97CE-0EF82836046A} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
1145-
{27E399C0-6F91-45D6-A63D-041DA41CCFDF} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
11461145
{0CBA5FB8-71A3-457A-89F3-E52B9602164A} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
11471146
{21C21975-84C1-4A24-8E21-F7EC790A4584} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
11481147
{19014C60-F87C-4CC7-AC0F-C41B6126EBCE} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
11491148
{94C8526E-DCC2-442F-9868-3DD0BA2688BE} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
11501149
{FA579C03-2EB4-4D47-88EE-BFF339E96FAF} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}
11511150
{1F0B4B3C-DC88-4740-B04F-1707102E9930} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
1151+
{D9617F63-15F4-4CA2-8ECF-728A94B45D82} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
11521152
EndGlobalSection
11531153
GlobalSection(ExtensibilityGlobals) = postSolution
11541154
SolutionGuid = {FB8F26CE-4DE6-433F-B32A-79183020BBD6}

src/Installer/core-sdk-tasks/GenerateMSBuildExtensionsSWR.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public override bool Execute()
2828
@"msbuildExtensions-ver",
2929
@"MSBuild\Current");
3030

31-
File.WriteAllText(OutputFile, sb.ToString());
31+
FileInfo outputFileInfo = new FileInfo(OutputFile);
32+
outputFileInfo.Directory.Create();
33+
File.WriteAllText(outputFileInfo.FullName, sb.ToString());
3234

3335
return true;
3436
}

src/Installer/redist-installer/packaging/windows/VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.nuspec

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Installer/redist-installer/projects/SdkResolver.csproj

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<Project Sdk="Microsoft.Build.NoTargets">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
5+
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
6+
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
7+
<!-- For product build, this project only builds in the second build pass as it depends on assets other
8+
verticals that are built in the first build pass. -->
9+
<ExcludeFromDotNetBuild Condition="'$(DotNetBuildPass)' != '2'">true</ExcludeFromDotNetBuild>
10+
<!-- For product build, this only builds in the second build pass as it depends on assets
11+
from other verticals that are built in the first build pass. -->
12+
<IsPackable Condition="'$(OS)' == 'Windows_NT' and
13+
'$(Architecture)' == 'x64' and
14+
'$(PgoInstrument)' != 'true' and
15+
'$(PackInstaller)' != 'false' and
16+
('$(DotNetBuild)' != 'true' or '$(DotNetBuildPass)' == '2')">true</IsPackable>
17+
<BeforePack>$(BeforePack);GenerateMSBuildExtensionsLayout</BeforePack>
18+
<PackageDescription>MSBuild extensions bundled with .NET Core SDK for internal Visual Studio build consumption</PackageDescription>
19+
<PackageId>VS.Redist.Common.Net.Core.SDK.MSBuildExtensions</PackageId>
20+
<NoWarn>$(NoWarn);NU5100;NU5109;NU5123</NoWarn>
21+
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
22+
<IsShippingPackage>false</IsShippingPackage>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<PackageDownload Include="NETStandard.Library.NETFramework" Version="[$(NETStandardLibraryNETFrameworkVersion)]" />
27+
28+
<ProjectReference Include="$(RepoRoot)src\Tasks\Microsoft.NET.Build.Extensions.Tasks\Microsoft.NET.Build.Extensions.Tasks.csproj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
29+
</ItemGroup>
30+
31+
<!-- SdkResolver -->
32+
<ItemGroup>
33+
<PackageDownload Include="Microsoft.Deployment.DotNet.Releases" Version="[$(MicrosoftDeploymentDotNetReleasesVersion)]" />
34+
<PackageDownload Include="Microsoft.NETCore.App.Runtime.win-x86" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />
35+
<PackageDownload Include="Microsoft.NETCore.App.Runtime.win-x64" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />
36+
<PackageDownload Include="Microsoft.NETCore.App.Runtime.win-arm64" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />
37+
38+
<ProjectReference Include="$(RepoRoot)src\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.csproj" ReferenceOutputAssembly="false" />
39+
</ItemGroup>
40+
41+
<!-- Shared infra to build and use the BuildCoreSdkTasks -->
42+
<Import Project="..\..\targets\BuildCoreSdkTasks.targets" />
43+
44+
<Target Name="GenerateMSBuildExtensionsLayout" DependsOnTargets="BuildCoreSdkTasks;ResolveProjectReferences">
45+
<PropertyGroup>
46+
<MSBuildExtensionsOutputPath>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Build.Extensions</MSBuildExtensionsOutputPath>
47+
<SdkMSBuildExtensionsSwrFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr</SdkMSBuildExtensionsSwrFile>
48+
</PropertyGroup>
49+
50+
<ItemGroup>
51+
<!-- Don't include .NET MS.NET.Build.Extensions tasks in Full Framework MSBuild layout. -->
52+
<VSMSBuildExtensionsContent Include="$(MSBuildExtensionsOutputPath)\msbuildExtensions\**\*.*"
53+
Exclude="$(MSBuildExtensionsOutputPath)\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\net*\**;
54+
$(MSBuildExtensionsOutputPath)\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\tools\net*.*\**"
55+
DeploymentSubpath="msbuildExtensions/" />
56+
57+
<!-- Don't include .NET targets in the Full Framework MSBuild layout. -->
58+
<VSMSBuildExtensionsContent Include="$(MSBuildExtensionsOutputPath)\msbuildExtensions-ver\**\*.*"
59+
Exclude="$(MSBuildExtensionsOutputPath)\msbuildExtensions-ver\SolutionFile\**"
60+
DeploymentSubpath="msbuildExtensions-ver/" />
61+
62+
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)netstandard.library.netframework\$(NETStandardLibraryNETFrameworkVersion)\build\**\*.*"
63+
Exclude="$(NuGetPackageRoot)netstandard.library.netframework\$(NETStandardLibraryNETFrameworkVersion)\build\**\*.props;
64+
$(NuGetPackageRoot)netstandard.library.netframework\$(NETStandardLibraryNETFrameworkVersion)\build\**\*.targets"
65+
DeploymentSubpath="msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/" />
66+
67+
<!-- SdkResolver -->
68+
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.deployment.dotNet.releases\$(MicrosoftDeploymentDotNetReleasesVersion)\lib\netstandard2.0\**\*.*" DeploymentSubpath="MSBuildSdkResolver/" />
69+
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.netcore.app.runtime.win-x86\$(MicrosoftNETCoreAppRuntimePackageVersion)\runtimes\win-x86\native\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/x86/" />
70+
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.netcore.app.runtime.win-x64\$(MicrosoftNETCoreAppRuntimePackageVersion)\runtimes\win-x64\native\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/x64/" />
71+
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.netcore.app.runtime.win-arm64\$(MicrosoftNETCoreAppRuntimePackageVersion)\runtimes\win-arm64\native\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/arm64/" />
72+
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.DotNet.MSBuildSdkResolver*.dll" DeploymentSubpath="MSBuildSdkResolver/" />
73+
74+
<VSMSBuildExtensionsContent Update="@(VSMSBuildExtensionsContent)">
75+
<DestinationPath>$(OutputPath)/%(VSMSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)</DestinationPath>
76+
</VSMSBuildExtensionsContent>
77+
</ItemGroup>
78+
79+
<Copy SourceFiles="@(VSMSBuildExtensionsContent)" DestinationFiles="%(VSMSBuildExtensionsContent.DestinationPath)" />
80+
81+
<GenerateMSBuildExtensionsSWR MSBuildExtensionsLayoutDirectory="$(OutputPath)"
82+
OutputFile="$(SdkMSBuildExtensionsSwrFile)" />
83+
84+
<ItemGroup>
85+
<!-- Include the swr file in the nuget package for VS authoring -->
86+
<Content Include="$(SdkMSBuildExtensionsSwrFile)" PackagePath="/" />
87+
<Content Include="@(VSMSBuildExtensionsContent)" PackagePath="/%(VSMSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)" />
88+
</ItemGroup>
89+
</Target>
90+
91+
</Project>

src/Installer/redist-installer/redist-installer.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<ItemGroup>
2020
<ProjectReference Include="..\..\Layout\redist\redist.csproj" ReferenceOutputAssembly="false" />
2121
<ProjectReference Include="$(RepoRoot)template_feed\*\*.csproj" ReferenceOutputAssembly="false" />
22-
<ProjectReference Include="projects\SdkResolver.csproj" ReferenceOutputAssembly="false" Condition="'$(DotNetBuild)' != 'true'" />
2322
</ItemGroup>
2423

2524
<ItemGroup>
@@ -36,7 +35,6 @@
3635
<Import Project="targets\GenerateBundledVersions.targets" />
3736
<Import Project="targets\Crossgen.targets" />
3837
<Import Project="targets\GenerateLayout.targets" />
39-
<Import Project="targets\GenerateMSBuildExtensions.targets" Condition="'$(PackInstaller)' != 'false'"/>
4038
<Import Project="targets\FileExtensions.targets" />
4139
<Import Project="targets\GenerateArchives.targets" Condition="'$(PackInstaller)' != 'false'"/>
4240
<Import Project="targets\GenerateMSIs.targets" />

src/Installer/redist-installer/targets/BuildCoreSdkTasks.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TaskTargetFramework>$(SdkTargetFramework)</TaskTargetFramework>
66
<TaskTargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core'">net472</TaskTargetFramework>
77

8-
<CoreSdkTaskDll>$(ArtifactsDir)bin\core-sdk-tasks\$(Configuration)\$(TaskTargetFramework)\core-sdk-tasks.dll</CoreSdkTaskDll>
8+
<CoreSdkTaskDll>$(ArtifactsDir)tasks\bin\core-sdk-tasks\$(Configuration)\$(TaskTargetFramework)\core-sdk-tasks.dll</CoreSdkTaskDll>
99
<CoreSdkTaskProject>$(RepoRoot)src\Installer\core-sdk-tasks\core-sdk-tasks.csproj</CoreSdkTaskProject>
1010
</PropertyGroup>
1111

0 commit comments

Comments
 (0)