Skip to content

Commit 719f781

Browse files
author
John Luo
authored
Compile using ref assemblies (dotnet/extensions#2483)
* Compile using ref assemblies * Use updated ResolveReferences.target from AspNetCore * Generate ref assemblies for .NET framework\n\nCommit migrated from dotnet/extensions@e771c42
1 parent 85da976 commit 719f781

File tree

5 files changed

+606
-0
lines changed

5 files changed

+606
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Reflection;
6+
7+
namespace Microsoft.Extensions.Logging
8+
{
9+
internal static class ProviderAliasUtilities
10+
{
11+
private const string AliasAttibuteTypeFullName = "Microsoft.Extensions.Logging.ProviderAliasAttribute";
12+
private const string AliasAttibuteAliasProperty = "Alias";
13+
14+
internal static string GetAlias(Type providerType)
15+
{
16+
foreach (var attribute in providerType.GetTypeInfo().GetCustomAttributes(inherit: false))
17+
{
18+
if (attribute.GetType().FullName == AliasAttibuteTypeFullName)
19+
{
20+
var valueProperty = attribute
21+
.GetType()
22+
.GetProperty(AliasAttibuteAliasProperty, BindingFlags.Public | BindingFlags.Instance);
23+
24+
if (valueProperty != null)
25+
{
26+
return valueProperty.GetValue(attribute) as string;
27+
}
28+
}
29+
}
30+
31+
return null;
32+
}
33+
}
34+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- This file is automatically generated. -->
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
<PropertyGroup>
4+
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
5+
</PropertyGroup>
6+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
7+
<Compile Include="Microsoft.AspNetCore.Testing.netstandard2.0.cs" />
8+
<Reference Include="Microsoft.Win32.Registry" />
9+
<Reference Include="System.ValueTuple" />
10+
<Reference Include="xunit.assert" />
11+
<Reference Include="xunit.extensibility.execution" />
12+
</ItemGroup>
13+
<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
14+
<Compile Include="Microsoft.AspNetCore.Testing.net46.cs" />
15+
<Reference Include="Microsoft.Win32.Registry" />
16+
<Reference Include="System.ValueTuple" />
17+
<Reference Include="xunit.assert" />
18+
<Reference Include="xunit.extensibility.execution" />
19+
<Reference Include="System.Net.Http" />
20+
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
21+
<Reference Include="System" />
22+
<Reference Include="System.Data" />
23+
<Reference Include="System.Drawing" />
24+
<Reference Include="System.Xml" />
25+
<Reference Include="System.Core" />
26+
<Reference Include="System.Runtime.Serialization" />
27+
<Reference Include="System.Xml.Linq" />
28+
<Reference Include="System.Numerics" />
29+
<Reference Include="System.IO.Compression.FileSystem" />
30+
<Reference Include="mscorlib" />
31+
</ItemGroup>
32+
</Project>

0 commit comments

Comments
 (0)