Update the S.T.E.W configurations to explicitly target a versioned TFM (nc3.0).#42069
Update the S.T.E.W configurations to explicitly target a versioned TFM (nc3.0).#42069safern merged 6 commits intodotnet:masterfrom
Conversation
| <RootNamespace>System.Text.Encodings.Web</RootNamespace> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <Configurations>netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release;netstandard2.1-Debug;netstandard2.1-Release</Configurations> | ||
| <Configurations>netcoreapp3.0-Debug;netcoreapp3.0-Release;netstandard-Debug;netstandard-Release;netstandard2.1-Debug;netstandard2.1-Release</Configurations> |
There was a problem hiding this comment.
Continuing to use TargetsNetCoreApp within item group conditions is fine, even with this change, correct?
Line 149 in 3b6ec2b
What about using the SDK constant in source for if/defs? Should these be changed to TFM specific (i.e. NETCOREAPP3_0)? I don't see any other use of that in the repo, but maybe this is the first instance. I see older TFMS though.
There was a problem hiding this comment.
Yes using TargetsNetCoreApp is fine. On the defines: in master I believe we use the SDK pattern where netcoreapp means any version, so these should be fine. Double check the IL to be sure (or test for the difference).
There was a problem hiding this comment.
Double check the IL to be sure (or test for the difference).
Yep, that's what I am doing to verify. I could instead use a custom constant, like we do in S.T.Json (that has the added benefit of being in sync with what we are doing in the release/3.1 for S.T.E.Web).
Edit: Yep, works as expected.
| <PropertyGroup> | ||
| <BuildConfigurations> | ||
| netcoreapp; | ||
| netcoreapp3.0; |
There was a problem hiding this comment.
Some of the references that S.T.E.W depends on don't have a config for netcoreapp3.0.
System.Diagnostics.Debug
System.Memory
System.Runtime
etc.
Should we also add the versioned TFM configs to all those (along side the version-less ones) or do we need to add package configurations here, instead?
corefx/src/System.Diagnostics.Debug/src/Configurations.props
Lines 4 to 5 in bd18c12
corefx/src/System.Memory/src/Configurations.props
Lines 4 to 5 in bd18c12
That's causing the CI failures:
##[error].dotnet\sdk\3.0.100\Microsoft.Common.CurrentVersion.targets(2106,5): error MSB3245: Could not resolve this reference. Could not locate the assembly "System.Runtime". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
There was a problem hiding this comment.
build -allconfigurations succeeds but targeting individual frameworks (particularly the default - netcoreapp) fails.
There was a problem hiding this comment.
This library is inbox as well so you will need a version-less build configuration but you will need to exclude it from the packages configuration so that it targets the latest.
So you do something like:
<PackageConfigurations>
netcoreapp3.0;
netstandard2.1;
netstandard;
</PackageConfigurations>
<BuildConfigurations>
$(PackageConfigurations);
netcoreapp;
</BuildConfigurations>There was a problem hiding this comment.
So you do something like
Thanks for the suggestion, @safern. That's precisely what I tried next, following precedence of other similar packages like Threading.Channels:
corefx/src/System.Threading.Channels/src/Configurations.props
Lines 2 to 12 in bd18c12
The netcoreapp3.0 package config still causes the failure though. I don't know if its because of contention caused by netstandard2.1 and netcoreapp3.0.
Let me retry that to verify.
There was a problem hiding this comment.
Awesome, that worked! I wasn't updating the Configurations property in the csproj locally to include netcoreapp which is why I was seeing the failure earlier.
| using System.Text.Unicode; | ||
|
|
||
| #if NETCOREAPP | ||
| #if BUILDING_INBOX_LIBRARY |
There was a problem hiding this comment.
You could do
#if !NETSTANDARD
...
#endif
And then that means anything but any version of netstandard.
There was a problem hiding this comment.
Any particular reason why one is considered better than the other? #if NETCOREAPP, vs #if !NETSTANDARD, vs #if CUSTOM_CONSTANT?
Would using constants like NETSTANDARD work in release/3.1?
There was a problem hiding this comment.
BUILDING_INBOX_LIBRARY is incorrect. You want this for the package build of Netcoreapp. I would recommend #if netcoreapp if that works in both master and release. I know that works in master: versionless define indicates any, as it does with the SDK. I think we still had the differing behavior in release, so a dedicated define may be appropriate. How about USE_INTRINSICS or something like that in release?
There was a problem hiding this comment.
Yes, the SDK constants do work in the release/3.x branches as well.
There was a problem hiding this comment.
I would recommend
#if netcoreappif that works in both master and release.
Any difference between lower-case and upper-case? I left it as upper-case since that's what is being used across the repo.
There was a problem hiding this comment.
Lower-case is what we used to define but we removed that some weeks ago, upper-case are the ones the SDK define based on the TFM.
…brary" This reverts commit 8648cf6.
|
The change is ready for review. Let me know if anything else needs to be addressed. |
…M (nc3.0). (dotnet/corefx#42069) * Update the S.T.E.W configurations to explicitly target a versioned TFM (nc3.0). * Use custom defined constant like S.T.Json - Building_Inbox_Library * Update config.props to use package config and leave netcoreapp as a build config * Add back netcoreapp specific config to the src csproj * Revert "Use custom defined constant like S.T.Json - Building_Inbox_Library" This reverts commit dotnet/corefx@8648cf6. * Remove extra new line. Commit migrated from dotnet/corefx@0954a97
The assets within the package on 3.0 were:
ns1.0, 2.0, 2.1
With this change (in master) we are adding a new asset:
ns1.0, 2.0, 2.1, nc3.0
Without this change, the new asset was targeting nc5.0 which isn't what we want.
Addresses #41933 (comment)
cc @ericstj, @ViktorHofer, @Anipik