Skip to content

Multi-target Microsoft.NET.HostModel #114343

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

Merged
merged 2 commits into from
Apr 7, 2025
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
1 change: 0 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
<SystemCollectionsImmutableToolsetVersion>8.0.0</SystemCollectionsImmutableToolsetVersion>
<SystemMemoryToolsetVersion>4.5.5</SystemMemoryToolsetVersion>
<SystemTextJsonToolsetVersion>8.0.5</SystemTextJsonToolsetVersion>
<SystemReflectionMetadataToolsetVersion>8.0.0</SystemReflectionMetadataToolsetVersion>
<SystemReflectionMetadataLoadContextToolsetVersion>8.0.0</SystemReflectionMetadataLoadContextToolsetVersion>
<SystemReflectionMetadataToolsetVersion>8.0.0</SystemReflectionMetadataToolsetVersion>
<SystemTextEncodingsWebToolsetVersion>8.0.0</SystemTextEncodingsWebToolsetVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public class ConflictingGuidException : Exception
{
public ConflictingGuidException(string typeName1, string typeName2, Guid guid)
{
#if NET
ArgumentNullException.ThrowIfNull(typeName1);
ArgumentNullException.ThrowIfNull(typeName2);
#else
if (typeName1 is null)
{
throw new ArgumentNullException(nameof(typeName1));
Expand All @@ -22,6 +26,7 @@ public ConflictingGuidException(string typeName1, string typeName2, Guid guid)
{
throw new ArgumentNullException(nameof(typeName2));
}
#endif
TypeName1 = typeName1;
TypeName2 = typeName2;
Guid = guid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ public class MissingGuidException : Exception
{
public MissingGuidException(string typeName)
{
#if NET
ArgumentNullException.ThrowIfNull(typeName);
#else
if (typeName is null)
{
throw new ArgumentNullException(nameof(typeName));
}
#endif
TypeName = typeName;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>$(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent)</TargetFrameworks>
<Description>Abstractions for modifying .NET host binaries</Description>
<IsShipping>false</IsShipping>
<IsPackable Condition="'$(BuildOnlyPgoInstrumentedAssets)' != 'true'">true</IsPackable>
Expand All @@ -14,16 +14,16 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Historically, the key for the managed projects is the AspNetCore key Arcade carries. -->
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
<DefineConstants>$(DefineConstants);HOST_MODEL</DefineConstants>
</PropertyGroup>

<ItemGroup>
<!-- SDK pins this to a lower version https://github.com/dotnet/sdk/issues/43325 -->
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataToolsetVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />

<ProjectReference Include="$(LibrariesProjectRoot)System.Text.Json\src\System.Text.Json.csproj" />
<!-- Manually reference these assemblies which are provided by MSBuild / .NET SDK -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageDownloadAndReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableToolsetVersion)" Folder="lib/net462" />
<PackageDownloadAndReference Include="System.Memory" Version="$(SystemMemoryToolsetVersion)" Folder="lib/net461" />
<PackageDownloadAndReference Include="System.Text.Json" Version="$(SystemTextJsonToolsetVersion)" Folder="lib/net462" />
<PackageDownloadAndReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataToolsetVersion)" Folder="lib/net462" />
</ItemGroup>

<ItemGroup>
Expand All @@ -35,4 +35,6 @@
<Compile Include="$(CoreClrProjectRoot)tools\Common\System\Collections\Generic\ArrayBuilder.cs" Link="Common\ArrayBuilder.cs" />
</ItemGroup>

<Import Project="$(RepositoryEngineeringDir)PackageDownloadAndReference.targets" />

</Project>
Loading