-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add a "GenerateReferenceSource" target and add four ref assembly projects. #20211
Conversation
I assume the PR should be ported to rel/2.0.0 after it is done ... (based on the original 2.0.0 milestone) |
dir.targets
Outdated
@@ -110,4 +110,15 @@ | |||
<Message Importance="High" Condition="'$(ConfigurationErrorMsg)' != ''" Text="$(MSBuildProjectFullPath) ConfigurationErrorMessage: $(ConfigurationErrorMsg)" /> | |||
</Target> | |||
|
|||
<Target Name="GenerateReferenceAssembly"> |
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 name isn't accurate, can it be "GenerateReferenceSource" instead?
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" /> |
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.
I would have expected a PropertyGroup here with at least a ProjectGuid. If you run UpdateVSConfigurations from root it should fix that. You may need to privately pick up the new buildtools that @weshaggard is merging, #20195. It has a fix to UpdateVSConfigurations to handle some projects recently checked in.
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.
I'll rebase and then run the target.
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.
LGTM, modulo a couple small suggestions
dir.targets
Outdated
@@ -110,4 +110,15 @@ | |||
<Message Importance="High" Condition="'$(ConfigurationErrorMsg)' != ''" Text="$(MSBuildProjectFullPath) ConfigurationErrorMessage: $(ConfigurationErrorMsg)" /> | |||
</Target> | |||
|
|||
<Target Name="GenerateReferenceAssembly"> | |||
<PropertyGroup> |
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.
For reference I do this in the standard repo at https://github.com/dotnet/standard/blob/master/netstandard/src/netstandard.csproj#L45 we should share the common pattern.
dir.targets
Outdated
@@ -110,4 +110,15 @@ | |||
<Message Importance="High" Condition="'$(ConfigurationErrorMsg)' != ''" Text="$(MSBuildProjectFullPath) ConfigurationErrorMessage: $(ConfigurationErrorMsg)" /> | |||
</Target> | |||
|
|||
<Target Name="GenerateReferenceAssembly"> |
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.
Should we hook this target up to the build so it will start to pend changes if any APIs change and hopefully we don't accidentally forget to update a ref or someone update it manually?
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.
Right now this will just be manual. @ericstj and I were discussing a few different things we would need to work through if we want to make it automatic in some way. And like you mentioned, the ref's aren't fully "standardized" right now, so it would cause a lot of churn at first.
@@ -135,5 +135,10 @@ | |||
<None Include="Resources\Misc\Signed.cs" /> | |||
<EmbeddedResource Include="Resources\Misc\Signed.exe" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<!-- Some internal types are needed, so we reference the implementation assembly, rather than the reference assembly. --> |
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.
boo...
@@ -0,0 +1,6 @@ | |||
// These attributes should be excluded from reference assemblies. | |||
|
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.
See https://github.com/dotnet/standard/blob/master/platforms/attributeExcludeList.txt for the complete set that I use for standard.
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.
I'll sync my version up with that.
We should consider moving this target into BuildTools as some future point. We should also consider running this for all the ref's across the repo to get them consistent. I know that @stephentoub did some work in the past to try and normalize the refs. |
* The GenerateReferenceAssembly target can be run as a manual step on a project. When run, it produces a source code file <Assembly>.cs, in the reference assembly folder for the library. This source file can be used to compile an equivalent reference assembly. * Use the target to generate reference assemblies for the following libraries: * System.Collections.Immutable * System.Reflection.Metadata * System.Threading.Tasks.Dataflow * System.Threading.Tasks.Extensions
@weshaggard I've filed https://github.com/dotnet/corefx/issues/20258 to track moving the target into buildtools. |
@mellinoe is it must-have for 2.0? If yes, can you please file tracking bug to port it to 2.0? |
@dotnet-bot Test Innerloop netfx Windows_NT Release x64 Build and Test |
The GenerateReferenceAssembly target can be run as a manual step on a project. When run, it produces a source code file .cs, in the reference assembly folder for the library. This source file can be used to compile an equivalent reference assembly.
Use the target to generate reference assemblies for the following libraries:
This will cut a chunk out of the total size of the reference assemblies we are shipping. This is part of https://github.com/dotnet/corefx/issues/14291.
@ericstj @weshaggard