Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to enable building msbuild with Unified Build #9685

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
src/Framework/README.md
src/Utilities/README.md
-->
<LatestDotNetCoreForMSBuild>$(NetCurrent)</LatestDotNetCoreForMSBuild>
<!-- When building in source-only modes, let the TFM float based on what arcade is in use.
When building in normal modes (independent build or a dotnet product build), set explicitly. -->
<LatestDotNetCoreForMSBuild>net8.0</LatestDotNetCoreForMSBuild>
<LatestDotNetCoreForMSBuild Condition="'$(DotNetBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">$(NetCurrent)</LatestDotNetCoreForMSBuild>
</PropertyGroup>

<PropertyGroup>
Expand Down
7 changes: 5 additions & 2 deletions eng/AfterSigning.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<Project>
<Target Name="CopyAMD64Symbols" Condition="'$(OfficialBuild)' == 'true' AND '$(ArcadeBuildFromSource)' != 'true'" BeforeTargets="Build">
<!-- Don't attempt to copy the PDBs at all when building on core on non-windows platforms. -->
<Target Name="CopyAMD64Symbols" Condition="'$(OfficialBuild)' == 'true' AND $([MSBuild]::IsOSPlatform('windows'))" BeforeTargets="Build">
<Copy
SourceFiles="$(ArtifactsBinDir)MSBuild\x64\Release\net472\MSBuild.pdb"
DestinationFolder="$(ArtifactsSymStoreDirectory)\MSBuild\net472\amd64"
/>
<!-- Excluded when building using msbuild core because msbuild core doesn't support targeting 3.5
See src\MSBuildTaskHost\MSBuildTaskHost.csproj-->
<Copy
SourceFiles="$(ArtifactsBinDir)MSBuildTaskHost\x64\Release\net35\MSBuildTaskHost.pdb"
DestinationFolder="$(ArtifactsSymStoreDirectory)\MSBuildTaskHost\net35\amd64"
/>
Condition="'$(MSBuildRuntimeType)' != 'Core' and '$(MonoBuild)' != 'true'"/>
</Target>
</Project>
2 changes: 1 addition & 1 deletion eng/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageVersion Include="System.Net.Http" Version="$(SystemNetHttpVersion)" />
<PackageVersion Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataLoadContextVersion)" />
<PackageVersion Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsPackageVersion)" />
<PackageVersion Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
<PackageVersion Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesVersion)" />
Expand Down
7 changes: 4 additions & 3 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>

<Target Name="ConfigureInnerBuildArgs"
BeforeTargets="GetSourceBuildCommandConfiguration"
Condition="'$(ArcadeBuildFromSource)' == 'true'">
<Target Name="ConfigureInnerBuildArgs" BeforeTargets="GetSourceBuildCommandConfiguration"
Condition="'$(ArcadeBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">
<PropertyGroup>
<!-- Filter down projects aggressively in source-only modes. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)MSBuild.SourceBuild.slnf"</InnerBuildArgs>

<!-- Disable package validation as source build filters out target frameworks. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:EnablePackageValidation=false</InnerBuildArgs>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
<SystemNetHttpVersion>4.3.4</SystemNetHttpVersion>
<SystemReflectionMetadataLoadContextVersion>8.0.0</SystemReflectionMetadataLoadContextVersion>
<SystemReflectionMetadataVersion>8.0.0</SystemReflectionMetadataVersion>
<SystemResourcesExtensionsPackageVersion>8.0.0</SystemResourcesExtensionsPackageVersion>
<SystemResourcesExtensionsVersion>8.0.0</SystemResourcesExtensionsVersion>
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemTextEncodingCodePagesVersion>7.0.0</SystemTextEncodingCodePagesVersion>
<SystemTextJsonVersion>8.0.0</SystemTextJsonVersion>
<SystemThreadingChannelsVersion>8.0.0</SystemThreadingChannelsVersion>
<SystemThreadingTasksDataflowVersion>8.0.0</SystemThreadingTasksDataflowVersion>
</PropertyGroup>
Expand All @@ -55,7 +56,6 @@
<MicrosoftNetCompilersToolsetVersion>4.9.0-3.23629.3</MicrosoftNetCompilersToolsetVersion>
<NuGetBuildTasksVersion>6.9.0-preview.1.70</NuGetBuildTasksVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemTextJsonVersion>8.0.0</SystemTextJsonVersion>
</PropertyGroup>
<Target Name="OverrideArcadeFileVersion" AfterTargets="_InitializeAssemblyVersion">
<!-- See https://github.com/dotnet/arcade/issues/3386
Expand Down
4 changes: 3 additions & 1 deletion src/Build/Microsoft.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<EnableDefaultItems>false</EnableDefaultItems>

<GenerateReferenceAssemblySource>true</GenerateReferenceAssemblySource>
<CreateTlb>true</CreateTlb>
<!-- Do not create Tlbs when building in .NET product mode. The packages are not shipped to VS,
only their contents redisted within the SDK. -->
<CreateTlb Condition="'$(DotNetBuild)' != 'true'">true</CreateTlb>
<IsPackable>true</IsPackable>
<PackageDescription>This package contains the $(MSBuildProjectName) assembly which is used to create, edit, and evaluate MSBuild projects.</PackageDescription>
<IncludeSatelliteOutputInPack>false</IncludeSatelliteOutputInPack>
Expand Down
4 changes: 3 additions & 1 deletion src/Deprecated/Engine/Microsoft.Build.Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<NoWarn>$(NoWarn);618</NoWarn>
<GenerateReferenceAssemblySource>true</GenerateReferenceAssemblySource>
<EnableDefaultItems>false</EnableDefaultItems>
<CreateTlb>true</CreateTlb>
<!-- Do not create Tlbs when building in .NET product mode. The packages are not shipped to VS,
only their contents redisted within the SDK. -->
<CreateTlb Condition="'$(DotNetBuild)' != 'true'">true</CreateTlb>
mmitche marked this conversation as resolved.
Show resolved Hide resolved
<AdditionalTlbExpAsmPaths>$(XMakeRefPath)</AdditionalTlbExpAsmPaths>
<PublishTlbPath>$(XMakeRefPath)</PublishTlbPath>
<GenerateAssemblyRefs>true</GenerateAssemblyRefs>
Expand Down
3 changes: 3 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
</ItemGroup>
</Target>

<!-- This target creates a type library for the assemblies in a package. It requires desktop msbuild to locate the tooling
Type libraries are still needed by Visual Studio in some cases, like the legacy C# project system.
It calls into msbuild via COM, and needs the type library to do so. -->
<Target Name="CreateTypeLib" BeforeTargets="AfterBuild" Inputs="$(TargetPath)" Outputs="$(TargetDir)$(TargetName).tlb;$(TargetDir)x64\$(TargetName).tlb" Condition="'$(BuildingInsideVisualStudio)' != 'true' and '$(CreateTlb)' == 'true' and $([MSBuild]::IsOSPlatform('windows')) and '$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(MSBuildRuntimeType)' != 'Core'">
mmitche marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<TlbExpPath>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToDotNetFrameworkSdkFile('tlbexp.exe'))</TlbExpPath>
Expand Down
4 changes: 3 additions & 1 deletion src/Framework/Microsoft.Build.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateReferenceAssemblySource>true</GenerateReferenceAssemblySource>
<CreateTlb>true</CreateTlb>
<!-- Do not create Tlbs when building in .NET product mode. The packages are not shipped to VS,
only their contents redisted within the SDK. -->
<CreateTlb Condition="'$(DotNetBuild)' != 'true'">true</CreateTlb>
<IsPackable>true</IsPackable>
<PackageDescription>This package contains the $(MSBuildProjectName) assembly which is a common assembly used by other MSBuild assemblies.</PackageDescription>
<IncludeSatelliteOutputInPack>false</IncludeSatelliteOutputInPack>
Expand Down
4 changes: 2 additions & 2 deletions src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<!-- This file is needed so the dotnet CLI knows how to map preview SDK versions to tfms (because tfms do not have preview information on them) -->
<!-- This is because according to semver, 2.1.0-preview is not >= 2.1.0 -->
<Content Include="$(RepoRoot).dotnet\sdk\$(DotNetCliVersion)\Microsoft.NETCoreSdk.BundledVersions.props" CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(DotNetRoot)sdk\$(DotNetCliVersion)\Microsoft.NETCoreSdk.BundledVersions.props" CopyToOutputDirectory="PreserveNewest" />

<!-- Include NuGet build tasks -->
<PackageReference Include="NuGet.Build.Tasks" />
Expand All @@ -44,7 +44,7 @@

<Content Include="$(MSBuildExtensionsPath)\**\*" LinkBase="Extensions" CopyToOutputDirectory="PreserveNewest" />

<Content Include="$(RepoRoot).dotnet\sdk\$(DotNetCliVersion)\RuntimeIdentifierGraph.json" CopyToOutputDirectory="PreserveNewest" />
<Content Include="$(DotNetRoot)sdk\$(DotNetCliVersion)\RuntimeIdentifierGraph.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<!-- Use deps file from this project with additional dependencies listed instead of the one generated in the MSBuild project -->
Expand Down
2 changes: 1 addition & 1 deletion src/MSBuild/MSBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@

<ItemGroup>
<_OurFiles Include="$(OutputPath)%(_TargetFrameworks.Identity)\MSBuild.exe.config" TargetFramework="%(_TargetFrameworks.Identity)" Condition=" '%(_TargetFrameworks.Identity)' == '$(FullFrameworkTFM)' " />
<_OurFiles Include="$(OutputPath)%(_TargetFrameworks.Identity)\Microsoft.Build.Framework.tlb" TargetFramework="%(_TargetFrameworks.Identity)" Condition=" '%(_TargetFrameworks.Identity)' == '$(FullFrameworkTFM)' " />
<_OurFiles Include="$(OutputPath)%(_TargetFrameworks.Identity)\Microsoft.Build.Framework.tlb" TargetFramework="%(_TargetFrameworks.Identity)" Condition=" '%(_TargetFrameworks.Identity)' == '$(FullFrameworkTFM)' and '$(CreateTlb)' == 'true'" />
<_OurFiles Include="$(OutputPath)%(_TargetFrameworks.Identity)\Microsoft.Data.Entity.targets" TargetFramework="%(_TargetFrameworks.Identity)" Condition=" '%(_TargetFrameworks.Identity)' == '$(FullFrameworkTFM)' " />
<_OurFiles Include="$(OutputPath)%(_TargetFrameworks.Identity)\Microsoft.ServiceModel.targets" TargetFramework="%(_TargetFrameworks.Identity)" Condition=" '%(_TargetFrameworks.Identity)' == '$(FullFrameworkTFM)' " />
<_OurFiles Include="$(OutputPath)%(_TargetFrameworks.Identity)\Microsoft.WinFx.targets" TargetFramework="%(_TargetFrameworks.Identity)" Condition=" '%(_TargetFrameworks.Identity)' == '$(FullFrameworkTFM)' " />
Expand Down
2 changes: 2 additions & 0 deletions src/Package/DevDivPackage/DevDivPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<PlatformTarget>x86</PlatformTarget>
<DisableSemVer2>true</DisableSemVer2>
<IsVisualStudioInsertionPackage>true</IsVisualStudioInsertionPackage>
<!-- VS insertion packages are not needed when doing a .NET product build. -->
<ExcludeFromDotNetBuild>true</ExcludeFromDotNetBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/Tasks/Microsoft.Build.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<AssemblyName>Microsoft.Build.Tasks.Core</AssemblyName>
<RootNamespace>Microsoft.Build.Tasks</RootNamespace>
<DefineConstants>$(DefineConstants);MICROSOFT_BUILD_TASKS</DefineConstants>
<CreateTlb>true</CreateTlb>
<!-- Do not create Tlbs when building in .NET product mode. The packages are not shipped to VS,
only their contents redisted within the SDK. -->
<CreateTlb Condition="'$(DotNetBuild)' != 'true'">true</CreateTlb>
<IsPackable>true</IsPackable>
<PackageDescription>This package contains the $(MSBuildProjectName) assembly which implements the commonly used tasks of MSBuild.</PackageDescription>
<IncludeSatelliteOutputInPack>false</IncludeSatelliteOutputInPack>
Expand Down