-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Manually add TypeForwardedTo in ref assemblies #14538
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 from all commits
4d95968
b8b55a7
0841344
9300b88
748b7ad
27e808a
507404f
2a3f2cc
1f7e509
cf902de
ecf967b
4b4ade6
6e7d41f
586d8a3
87f753a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
<PropertyGroup> | ||
<_RefSourceOutputPath>$([System.IO.Directory]::GetParent('$(MSBuildProjectDirectory)'))/ref/</_RefSourceOutputPath> | ||
<_RefSourceFileName>$(AssemblyName).$(TargetFramework).cs</_RefSourceFileName> | ||
<_ManualRefSourceFileName>$(AssemblyName).Manual.cs</_ManualRefSourceFileName> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any typeforwards that are TFM specific? Like, in ns2.0 the type was still in assembly A, and then we moved it to assembly B for nca3.0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not right now. I want to keep this simple for now, but I do recognize that there could potentially be TFM dependency manual content. If that arises, we'll need to make the Manual.cs files TFM specific. There are other clean up items I'd like to make so I'll file a followup issue. |
||
<_RefSourceFileOutputPath>$(_RefSourceOutputPath)$(_RefSourceFileName)</_RefSourceFileOutputPath> | ||
</PropertyGroup> | ||
|
||
|
@@ -76,10 +77,16 @@ | |
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<_ManualReferenceAssemblyContent /> | ||
<_ManualReferenceAssemblyContent Condition="Exists('$(_RefSourceOutputPath)$(_ManualRefSourceFileName)')"> | ||
<![CDATA[ | ||
<Compile Include="$(_ManualRefSourceFileName)" />]]> | ||
</_ManualReferenceAssemblyContent> | ||
|
||
<ReferencesContent> | ||
<![CDATA[ | ||
<ItemGroup Condition="'%24(TargetFramework)' == '$(TargetFramework)'"> | ||
<Compile Include="$(_RefSourceFileName)" /> | ||
<Compile Include="$(_RefSourceFileName)" />]]>$(_ManualReferenceAssemblyContent)<![CDATA[ | ||
@(FilteredOriginalReferences->'<Reference Include="%(Identity)" />', '%0A ') | ||
</ItemGroup> | ||
]]> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,10 +36,17 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
|
||
<!-- Reference implementation assemblies in addition to ref assemblies to get xml docs --> | ||
<ReferenceImplementationAssemblies>true</ReferenceImplementationAssemblies> | ||
<!-- We are ignoring MSB3243 warnings since implemenation and reference assemblies are versioned differently. We need both to compose the targeting pack with reference assemblies and xml docs. --> | ||
<MSBuildWarningsAsMessages>MSB3243</MSBuildWarningsAsMessages > | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this workaround if possible. Should not be necessary since everything has the same assembly versions now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll want to eventually take the approach of building against ref assemblies which means this will come back. Also, I don't want to respin the builds again. But I'll definitely file a follow up issue for further work and mention it there. |
||
|
||
<!-- Platform manifest data --> | ||
<FrameworkListFileName>FrameworkList.xml</FrameworkListFileName> | ||
<FrameworkListOutputPath>$(ArtifactsObjDir)$(FrameworkListFileName)</FrameworkListOutputPath> | ||
|
||
<!-- Platform manifest and package override metatdata --> | ||
<ReferencePackSharedFxVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).0</ReferencePackSharedFxVersion> | ||
JunTaoLuo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<ReferencePackSharedFxVersion Condition="'$(VersionSuffix)' != ''">$(ReferencePackSharedFxVersion)-$(VersionSuffix)</ReferencePackSharedFxVersion> | ||
<ReferencePlatformManifestOutputPath>$(ArtifactsObjDir)ref\PlatformManifest.txt</ReferencePlatformManifestOutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
@@ -93,6 +100,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
|
||
<!-- This target finds the reference assemblies. --> | ||
<Target Name="_ResolveTargetingPackContent" | ||
Returns="@(AspNetCoreReferenceAssemblyPath)" | ||
BeforeTargets="_GetPackageFiles" | ||
DependsOnTargets="ResolveReferences;FindReferenceAssembliesForReferences"> | ||
<ItemGroup> | ||
|
@@ -109,28 +117,42 @@ This package is an internal implementation of the .NET Core SDK and is not meant | |
Exclude=" | ||
@(_SelectedExtensionsRefAssemblies); | ||
@(ReferencePathWithRefAssemblies->WithMetadataValue('NuGetPackageId', 'Microsoft.NETCore.App.Ref')); | ||
@(ReferencePathWithRefAssemblies->WithMetadataValue('IsReferenceAssembly', 'false')); | ||
@(ReferencePathWithRefAssemblies->WithMetadataValue('ReferenceGrouping', 'Microsoft.NETCore.App'));" /> | ||
|
||
<AspNetCoreReferenceAssemblyPath | ||
Include="@(_SelectedExtensionsRefAssemblies->'$(MicrosoftInternalExtensionsRefsPath)%(FileName)%(Extension)')" /> | ||
|
||
<AspNetCoreReferenceDocXml Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('IsReferenceAssembly', 'false')->'%(RootDir)%(Directory)%(FileName).xml')" /> | ||
<AspNetCoreReferenceDocXml Include="@(_SelectedExtensionsRefAssemblies->'$(MicrosoftInternalExtensionsRefsPath)%(FileName).xml')" /> | ||
</ItemGroup> | ||
|
||
<RepoTasks.GenerateSharedFrameworkDepsFile | ||
DepsFilePath="$(ProjectDepsFilePath)" | ||
TargetFramework="$(TargetFramework)" | ||
FrameworkName="$(TargetingPackName)" | ||
FrameworkVersion="$(ReferencePackSharedFxVersion)" | ||
References="@(AspNetCoreReferenceAssemblyPath)" | ||
RuntimeIdentifier="$(TargetRuntimeIdentifier)" | ||
RuntimePackageName="$(PackageId)" | ||
PlatformManifestOutputPath="$(ReferencePlatformManifestOutputPath)" /> | ||
|
||
<ItemGroup> | ||
<RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" PackagePath="$(RefAssemblyPackagePath)" /> | ||
<RefPackContent Include="@(AspNetCoreReferenceDocXml)" PackagePath="$(RefAssemblyPackagePath)" /> | ||
<RefPackContent Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(ManifestsPackagePath)" /> | ||
<RefPackContent Include="$(PlatformManifestOutputPath)" PackagePath="$(ManifestsPackagePath)" /> | ||
<RefPackContent Include="$(ReferencePlatformManifestOutputPath)" PackagePath="$(ManifestsPackagePath)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="GeneratePackageConflictManifest" | ||
DependsOnTargets="ResolveReferences" | ||
Inputs="$(MSBuildAllProjects)" | ||
Outputs="$(TargetDir)$(PackageConflictManifestFileName)"> | ||
|
||
<ItemGroup> | ||
<_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(NuGetPackageId)|%(NuGetPackageVersion)')" Condition=" '%(ReferencePath.NuGetPackageId)' != 'Microsoft.NETCore.App' AND '%(ReferencePath.NuGetSourceType)' == 'Package' " /> | ||
<_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(FileName)|$(SharedFxVersion)')" Condition=" '%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' " /> | ||
<_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(FileName)|$(ReferencePackSharedFxVersion)')" Condition=" '%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' AND '%(ReferencePath.IsReferenceAssembly)' == 'true' " /> | ||
</ItemGroup> | ||
|
||
<WriteLinesToFile | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
using Microsoft.AspNetCore.Routing; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Http.Features; | ||
|
||
[assembly: TypeForwardedTo(typeof(IEndpointFeature))] | ||
[assembly: TypeForwardedTo(typeof(IRouteValuesFeature))] | ||
[assembly: TypeForwardedTo(typeof(Endpoint))] | ||
[assembly: TypeForwardedTo(typeof(EndpointMetadataCollection))] | ||
[assembly: TypeForwardedTo(typeof(RouteValueDictionary))] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionProvider))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionProviderContext))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiParameterDescription))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiParameterRouteInfo))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiRequestFormat))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiResponseFormat))] | ||
[assembly: TypeForwardedTo(typeof(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiResponseType))] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
using Microsoft.AspNetCore.Mvc.Formatters; | ||
|
||
[assembly: TypeForwardedTo(typeof(InputFormatterException))] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
[assembly: TypeForwardedTo(typeof(JsonResult))] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
|
||
[assembly: TypeForwardedTo(typeof(DefaultTagHelperContent))] | ||
[assembly: TypeForwardedTo(typeof(HtmlAttributeNameAttribute))] | ||
[assembly: TypeForwardedTo(typeof(HtmlAttributeNotBoundAttribute))] | ||
[assembly: TypeForwardedTo(typeof(HtmlTargetElementAttribute))] | ||
[assembly: TypeForwardedTo(typeof(ITagHelper))] | ||
[assembly: TypeForwardedTo(typeof(ITagHelperComponent))] | ||
[assembly: TypeForwardedTo(typeof(NullHtmlEncoder))] | ||
[assembly: TypeForwardedTo(typeof(OutputElementHintAttribute))] | ||
[assembly: TypeForwardedTo(typeof(ReadOnlyTagHelperAttributeList))] | ||
[assembly: TypeForwardedTo(typeof(RestrictChildrenAttribute))] | ||
[assembly: TypeForwardedTo(typeof(TagHelper))] | ||
[assembly: TypeForwardedTo(typeof(TagHelperAttribute))] | ||
[assembly: TypeForwardedTo(typeof(TagHelperAttributeList))] | ||
[assembly: TypeForwardedTo(typeof(TagHelperComponent))] | ||
[assembly: TypeForwardedTo(typeof(TagHelperContent))] | ||
[assembly: TypeForwardedTo(typeof(TagHelperContext))] | ||
[assembly: TypeForwardedTo(typeof(TagHelperOutput))] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
using Microsoft.AspNetCore.Authorization; | ||
|
||
// Microsoft.AspNetCore.Metadata | ||
[assembly: TypeForwardedTo(typeof(IAuthorizeData))] | ||
[assembly: TypeForwardedTo(typeof(IAllowAnonymous))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is fine so long as everything you are shipping here is only supporting .NETCore. If you are supporting .NETFramework (desktop) with any of these reference assemblies then they need to match the implementation assembly version for binding redirects to work correctly. This may be irrelevant if you are only building these for ref/runtime packs on .NETCore.