[DONT_MERGE_YET][msbuild][mac][ios] bxc#58504: Fix referencing netstandard projects - #2640
Closed
radical wants to merge 1 commit into
Closed
[DONT_MERGE_YET][msbuild][mac][ios] bxc#58504: Fix referencing netstandard projects#2640radical wants to merge 1 commit into
radical wants to merge 1 commit into
Conversation
rolfbjarne
approved these changes
Sep 11, 2017
rolfbjarne
left a comment
Member
There was a problem hiding this comment.
LGTM, but it needs to go into master first.
Member
Author
|
I found an issue that needs to be fixed first. |
Contributor
|
Yes, we won't have permission to backport into 15.4 unless it's verified (by QA) in master. |
chamons
approved these changes
Sep 11, 2017
chamons
left a comment
Contributor
There was a problem hiding this comment.
Looks reasonable enough, but I really would like that XM msbuild test that I wrote for you attached with the fix if possible.
Contributor
Contributor
|
Build failure |
Building a XI or XM (Modern) project that references a netstandard 2.0 project with msbuild fails because of a missing reference to `netstandard.dll`. AppDelegate.cs(21,52): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The reason is that XI and XM (Modern) projects have `$(TargetFrameworkIdentifier) != .NETFramework`, so targets from `Microsoft.NET.Build.Extensions` which provide ns2.0 support don't get imported. `ImplicitlyExpandNETStandardFacades` in particular, which would have added a reference to `netstandard.dll`. `netstandard.dll` gets included as part of the facades expanded by `ImplicitlyExpandDesignTimeFacades`, but this gets skipped if the project does not have a `System.Runtime` dependent reference. Instead, we want to expand the facades if any reference depends on `System.Runtime` OR `netstandard`. And for that we scan all the references for a `netstandard` dependency using the `GetDependsOnNETStandard` task. Partially fixes bxc #58504 .
radical
force-pushed
the
xi-xm-fix-ns20-ref-d15-4
branch
from
September 11, 2017 14:23
86457c8 to
a975c3e
Compare
Member
Author
|
Opened a new PR against master: #2643 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building a XI or XM (Modern) project that references a netstandard 2.0
project with msbuild fails because of a missing reference to
netstandard.dll.AppDelegate.cs(21,52): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
The reason is that XI and XM (Modern) projects have
$(TargetFrameworkIdentifier) != .NETFramework, so targets fromMicrosoft.NET.Build.Extensionswhich provide ns2.0 support don't getimported.
ImplicitlyExpandNETStandardFacadesin particular, whichwould have added a reference to
netstandard.dll.So, instead we duplicate that in XI/XM targets. Essentially, we need to
scan all the references for a
netstandarddependency (usingGetDependsOnNETStandardtask) and if found, add thenetstandard.dllreference.
Partially fixes bxc 58504.