Skip to content

Commit

Permalink
Better structure VMR join points for resolvers (#44428)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorHofer authored Oct 30, 2024
1 parent f0ec485 commit 2e7615d
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 248 deletions.
1 change: 0 additions & 1 deletion source-build.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"src\\Microsoft.Win32.Msi\\Microsoft.Win32.Msi.csproj",
"src\\RazorSdk\\Tasks\\Microsoft.NET.Sdk.Razor.Tasks.csproj",
"src\\RazorSdk\\Tool\\Microsoft.NET.Sdk.Razor.Tool.csproj",
"src\\Resolvers\\Microsoft.DotNet.MSBuildSdkResolver\\Microsoft.DotNet.MSBuildSdkResolver.csproj",
"src\\Resolvers\\Microsoft.DotNet.NativeWrapper\\Microsoft.DotNet.NativeWrapper.csproj",
"src\\Resolvers\\Microsoft.DotNet.SdkResolver\\Microsoft.DotNet.SdkResolver.csproj",
"src\\Resolvers\\Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver\\Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.csproj",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<Project Sdk="Microsoft.Build.NoTargets">

<PropertyGroup>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<TargetFramework>net472</TargetFramework>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<!-- For product build, this project only builds in the second build pass as it depends on assets other
<!-- For product build, this project only builds in the second build pass as it depends on assets from other
verticals that are built in the first build pass. -->
<ExcludeFromDotNetBuild Condition="'$(DotNetBuildPass)' != '2'">true</ExcludeFromDotNetBuild>
<!-- For product build, this only builds in the second build pass as it depends on assets
from other verticals that are built in the first build pass. -->
<IsPackable Condition="'$(OS)' == 'Windows_NT' and
'$(Architecture)' == 'x64' and
'$(PgoInstrument)' != 'true' and
'$(PackInstaller)' != 'false' and
('$(DotNetBuild)' != 'true' or '$(DotNetBuildPass)' == '2')">true</IsPackable>
<BeforePack>$(BeforePack);GenerateMSBuildExtensionsLayout</BeforePack>
<PackageDescription>MSBuild extensions bundled with .NET Core SDK for internal Visual Studio build consumption</PackageDescription>
'$(PgoInstrument)' != 'true'">true</IsPackable>
<BeforePack>$(BeforePack);GenerateLayout</BeforePack>
<PackageId>VS.Redist.Common.Net.Core.SDK.MSBuildExtensions</PackageId>
<PackageDescription>MSBuild extensions bundled with .NET Core SDK for internal Visual Studio build consumption</PackageDescription>
<NoWarn>$(NoWarn);NU5100;NU5109;NU5123</NoWarn>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<IsShippingPackage>false</IsShippingPackage>
Expand All @@ -26,22 +21,13 @@
<PackageDownload Include="NETStandard.Library.NETFramework" Version="[$(NETStandardLibraryNETFrameworkVersion)]" />

<ProjectReference Include="$(RepoRoot)src\Tasks\Microsoft.NET.Build.Extensions.Tasks\Microsoft.NET.Build.Extensions.Tasks.csproj" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
</ItemGroup>

<!-- SdkResolver -->
<ItemGroup>
<PackageDownload Include="Microsoft.Deployment.DotNet.Releases" Version="[$(MicrosoftDeploymentDotNetReleasesToolsetPackageVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Runtime.win-x86" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Runtime.win-x64" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />
<PackageDownload Include="Microsoft.NETCore.App.Runtime.win-arm64" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />

<ProjectReference Include="$(RepoRoot)src\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>

<!-- Shared infra to build and use the BuildCoreSdkTasks -->
<Import Project="..\..\targets\BuildCoreSdkTasks.targets" />

<Target Name="GenerateMSBuildExtensionsLayout" Condition="'$(IsPackable)' == 'true'" DependsOnTargets="BuildCoreSdkTasks;ResolveProjectReferences">
<Target Name="GenerateLayout" Condition="'$(IsPackable)' == 'true'" DependsOnTargets="BuildCoreSdkTasks;ResolveProjectReferences">
<PropertyGroup>
<MSBuildExtensionsOutputPath>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Build.Extensions</MSBuildExtensionsOutputPath>
<SdkMSBuildExtensionsSwrFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr</SdkMSBuildExtensionsSwrFile>
Expand All @@ -65,10 +51,10 @@
DeploymentSubpath="msbuildExtensions/Microsoft/Microsoft.NET.Build.Extensions/" />

<!-- SdkResolver -->
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.deployment.dotNet.releases\$(MicrosoftDeploymentDotNetReleasesToolsetPackageVersion)\lib\netstandard2.0\**\*.*" DeploymentSubpath="MSBuildSdkResolver/" />
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.netcore.app.runtime.win-x86\$(MicrosoftNETCoreAppRuntimePackageVersion)\runtimes\win-x86\native\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/x86/" />
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.netcore.app.runtime.win-x64\$(MicrosoftNETCoreAppRuntimePackageVersion)\runtimes\win-x64\native\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/x64/" />
<VSMSBuildExtensionsContent Include="$(NuGetPackageRoot)microsoft.netcore.app.runtime.win-arm64\$(MicrosoftNETCoreAppRuntimePackageVersion)\runtimes\win-arm64\native\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/arm64/" />
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\x86\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/x86/" />
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\x64\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/x64/" />
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\arm64\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/arm64/" />
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.Deployment.DotNet.Releases*.dll" DeploymentSubpath="MSBuildSdkResolver/" />
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.DotNet.MSBuildSdkResolver*.dll" DeploymentSubpath="MSBuildSdkResolver/" />

<VSMSBuildExtensionsContent Update="@(VSMSBuildExtensionsContent)">
Expand All @@ -80,7 +66,6 @@

<GenerateMSBuildExtensionsSWR MSBuildExtensionsLayoutDirectory="$(OutputPath)"
OutputFile="$(SdkMSBuildExtensionsSwrFile)" />

<ItemGroup>
<!-- Include the swr file in the nuget package for VS authoring -->
<Content Include="$(SdkMSBuildExtensionsSwrFile)" PackagePath="/" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,73 +1,43 @@
<Project Sdk="Microsoft.Build.NoTargets">

<PropertyGroup>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<TargetFramework>net472</TargetFramework>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
<!-- For product build, this project only builds in the second build pass as it depends on assets other
<!-- For product build, this project only builds in the second build pass as it depends on assets from other
verticals that are built in the first build pass. -->
<ExcludeFromDotNetBuild Condition="'$(DotNetBuildPass)' != '2'">true</ExcludeFromDotNetBuild>
<IsPackable Condition="'$(OS)' == 'Windows_NT' and
'$(Architecture)' == 'x64' and
'$(PgoInstrument)' != 'true'">true</IsPackable>
<BeforePack>$(BeforePack);GenerateLayout</BeforePack>
<PackageId>VS.Redist.Common.Net.Core.SDK.VSTemplateLocator</PackageId>
<PackageDescription>MSBuild extensions bundled with .NET Core SDK for internal Visual Studio build consumption</PackageDescription>
<NoWarn>$(NoWarn);NU5100;NU5109;NU5123</NoWarn>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<IsShippingPackage>false</IsShippingPackage>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App.Runtime.win-x86" ExcludeAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.NETCore.App.Runtime.win-x64" ExcludeAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.NETCore.App.Runtime.win-arm64" ExcludeAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Deployment.DotNet.Releases" ExcludeAssets="all" GeneratePathProperty="true" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Microsoft.DotNet.TemplateLocator\Microsoft.DotNet.TemplateLocator.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>

<Target Name="GenerateLayout">
<!-- Set these here early enough for inputs & outputs in the GenerateVSTemplateLocatorNupkg target. -->
<PropertyGroup>
<VSTemplateLocatorNuspecFile>$(MSBuildThisFileDirectory)VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.nuspec</VSTemplateLocatorNuspecFile>
<VSTemplateLocatorNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.VSTemplateLocator.$(FullNugetVersion).nupkg</VSTemplateLocatorNupkgFile>
<GenerateNupkgPowershellScript>$(MSBuildThisFileDirectory)../../packaging/windows/generatenupkg.ps1</GenerateNupkgPowershellScript>
</PropertyGroup>

<RemoveDir Directories="$(OutputPath)" />
<MakeDir Directories="$(OutputPath)" />

<Target Name="GenerateLayout" Condition="'$(IsPackable)' == 'true'" DependsOnTargets="ResolveProjectReferences">
<ItemGroup>
<_VSTemplateLocatorSrc Include="$(PkgMicrosoft_NETCore_App_Runtime_win-x86)\runtimes\win-x86\native\hostfxr.dll" Arch="x86\" />
<_VSTemplateLocatorSrc Include="$(PkgMicrosoft_NETCore_App_Runtime_win-x64)\runtimes\win-x64\native\hostfxr.dll" Arch="x64\" />
<_VSTemplateLocatorSrc Include="$(PkgMicrosoft_NETCore_App_Runtime_win-arm64)\runtimes\win-arm64\native\hostfxr.dll" Arch="arm64\" />
<_VSTemplateLocatorSrc Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\Microsoft.DotNet.NativeWrapper.dll" Arch="" />
<_VSTemplateLocatorSrc Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\Microsoft.DotNet.SdkResolver.dll" Arch="" />
<_VSTemplateLocatorSrc Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\**\Microsoft.DotNet.TemplateLocator*.dll" Arch="" />
<_VSTemplateLocatorSrc Include="$(PkgMicrosoft_Deployment_DotNet_Releases)\lib\net452\**\*.dll" Arch="" />
<_VSTemplateLocatorDst Include="@(_VSTemplateLocatorSrc->'$(OutputPath)VSTemplateLocator\%(Arch)%(RecursiveDir)%(Filename)%(Extension)')" />
</ItemGroup>
<VSTemplateLocatorContent Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\x86\hostfxr.dll" Arch="x86/" />
<VSTemplateLocatorContent Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\x64\hostfxr.dll" Arch="x64/" />
<VSTemplateLocatorContent Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\arm64\hostfxr.dll" Arch="arm64/" />

<Copy SourceFiles="@(_VSTemplateLocatorSrc)" DestinationFiles="@(_VSTemplateLocatorDst)" />
<VSTemplateLocatorContent Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\Microsoft.DotNet.NativeWrapper.dll" Arch="" />
<VSTemplateLocatorContent Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\Microsoft.DotNet.SdkResolver.dll" Arch="" />
<VSTemplateLocatorContent Include="$(ArtifactsBinDir)Microsoft.DotNet.TemplateLocator\$(Configuration)\net472\**\Microsoft.DotNet.TemplateLocator*.dll" Arch="" />

<Message Importance="High" Text="$(MSBuildProjectName) -&gt; $(OutputPath)" />
</Target>
<VSTemplateLocatorContent Include="$(PkgMicrosoft_Deployment_DotNet_Releases)\lib\net452\**\*.dll" Arch="" />
</ItemGroup>

<!-- For product build, this only builds in the second build pass as it depends on assets
from other verticals that are built in the first build pass. -->
<Target Name="GenerateVSTemplateLocatorNupkg"
DependsOnTargets="GenerateLayout"
Condition="'$(OS)' == 'Windows_NT' and
'$(Architecture)' == 'x64' and
'$(PgoInstrument)' != 'true' and
('$(DotNetBuild)' != 'true' or '$(DotNetBuildPass)' == '2') and
'$(_SuppressAllTargets)' != 'true'"
Inputs="$(OutputPath)/**/*;
$(VSTemplateLocatorNuspecFile);
$(GenerateNupkgPowershellScript)"
Outputs="$(VSTemplateLocatorNupkgFile)"
AfterTargets="Build">
<Exec Command="powershell -NoProfile -NoLogo $(GenerateNupkgPowershellScript) ^
'$(ArtifactsDir)' ^
'$(OutputPath.TrimEnd('\'))' ^
'$(FullNugetVersion)' ^
'$(VSTemplateLocatorNuspecFile)' ^
'$(VSTemplateLocatorNupkgFile)'" />
<ItemGroup>
<Content Include="@(VSTemplateLocatorContent)" PackagePath="/VSTemplateLocator/%(Arch)%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
</Target>

</Project>
15 changes: 0 additions & 15 deletions src/Installer/redist-installer/targets/SetBuildDefaults.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@
<UsePortableLinuxSharedFramework Condition=" '$(UsePortableLinuxSharedFramework)' == '' AND '$(IsLinux)' == 'True' AND '$(Rid)' != 'rhel.6-x64' AND !$(Rid.StartsWith('linux-musl')) ">true</UsePortableLinuxSharedFramework>
<HighEntropyVA>true</HighEntropyVA>

<!-- Only use asset target fallback that we set (not implicit one to net461). -->
<!--<DisableImplicitAssetTargetFallback>true</DisableImplicitAssetTargetFallback>-->

<!-- NU1701: Disable asset target fallback warning globally since it does not work transitively on NoWarn of individual packages -->
<!-- Since we disabled the implicit fallback to net461, this will only kick in when we have an explicit fallback and we don't need to be warned about it doing what we asked it to do. -->
<!-- NU5104: Disable 'A stable release of a package should not have a prerelease dependency' warning globally -->
<!-- The "pack" command under 'buildCrossTargeting' for 'Microsoft.DotNet.MSBuildSdkResolver' throws a "NU5104" warning/error while using a "2.1.300" stage0 SDK. For: Linux-x64, Linux-arm, and Linux-arm64 -->
<!--<NoWarn>NU1701;NU5104</NoWarn>-->

<!--<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' AND '$(OS)' == 'Windows_NT' ">true</IncludeWpfAndWinForms>
<IncludeWpfAndWinForms Condition=" '$(IncludeWpfAndWinForms)' == '' ">false</IncludeWpfAndWinForms>-->

<PathListSeparator>:</PathListSeparator>
<PathListSeparator Condition=" '$(OS)' == 'Windows_NT' ">%3b</PathListSeparator>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,17 @@

<PropertyGroup>
<TargetFrameworks>$(ResolverTargetFramework);net472</TargetFrameworks>
<TargetFrameworks Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'false' ">$(ResolverTargetFramework)</TargetFrameworks>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifiers Condition="$([MSBuild]::IsOSPlatform(`Windows`))">win-x86;win-x64</RuntimeIdentifiers>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- For product build, the .NET Framework TFM only builds in the second build pass as it depends on assets from other
verticals that are built in the first build pass. -->
<TargetFrameworks Condition="'$(DotNetBuild)' == 'true' and '$(DotNetBuildPass)' != '2'">$(ResolverTargetFramework)</TargetFrameworks>
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
<IsPackable>true</IsPackable>
<!-- Create FileDefinitions items for ResolveHostfxrCopyLocalContent target -->
<EmitLegacyAssetsFileItems>true</EmitLegacyAssetsFileItems>
<PackageId>microsoft.dotnet.templateLocator</PackageId>
<Nullable>Enable</Nullable>

<Nullable>enable</Nullable>
<!-- https://github.com/dotnet/sdk/issues/14801 -->
<AssemblyVersion Condition="'$(TargetFramework)'=='net472'">5.0.100.0</AssemblyVersion>

<!--https://github.com/NuGet/Home/issues/3891#issuecomment-377319939-->
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
<AssemblyVersion Condition="'$(TargetFramework)' == 'net472'">5.0.100.0</AssemblyVersion>
</PropertyGroup>

<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
</ItemGroup>
</Target>

<Target Name="LinkVSEmbeddableAssemblies" DependsOnTargets="ResolveReferences" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferencePath Condition="'%(ReferencePath.FileName)' == 'Microsoft.VisualStudio.Setup.Configuration.Interop'">
Expand Down Expand Up @@ -61,4 +48,5 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonToolsetPackageVersion)" />
</ItemGroup>

</Project>
Loading

0 comments on commit 2e7615d

Please sign in to comment.