-
Notifications
You must be signed in to change notification settings - Fork 515
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
[msbuild][mac][ios] Fix referencing netstandard projects #2643
Merged
Conversation
This file contains 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
radical
changed the title
[msbuild][mac][ios] Fix referencing netstandard projects
[DONT_MERGE_YET][msbuild][mac][ios] Fix referencing netstandard projects
Sep 11, 2017
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 .
rolfbjarne
approved these changes
Sep 11, 2017
emaf
approved these changes
Sep 11, 2017
radical
force-pushed
the
xi-xm-fix-ns20-ref-master
branch
from
September 11, 2017 18:17
2a7cc3b
to
cfe80b6
Compare
Let me create a 2nd PR that has the test case to prevent blocking this PR. |
chamons
approved these changes
Sep 11, 2017
Build failure |
radical
changed the title
[DONT_MERGE_YET][msbuild][mac][ios] Fix referencing netstandard projects
[msbuild][mac][ios] Fix referencing netstandard projects
Sep 13, 2017
chamons
pushed a commit
to chamons/xamarin-macios
that referenced
this pull request
Sep 13, 2017
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 .
chamons
added a commit
that referenced
this pull request
Sep 21, 2017
…2731) - https://bugzilla.xamarin.com/show_bug.cgi?id=59474 - The idea is to force Full and Modern to expand facades the same way. That way, we get the same, working behavior. - f79f2e4 was not sufficient, even though it matched XI, because of the difference between XI (and Modern) and what Full was doing. - Some context: PR #2685 And that was problematic because it was expanding the netstandard facades from `Microsoft.NET.Build.Extensions` in the `ImplicitlyExpandNETStandardFacades` target. But we want to build against XM's bundled facades *only*. So we disable the ns facades completely by setting `$(ImplicitlyExpandNETStandardFacades) = false`. But now we are in the situation where a XM/Full project referencing a ns project might fail to build because of a missing `netstandard.dll` reference! And this same case was fixed for XM/Modern projects in #2643 . So, we enable the use of that for XM/Full projects too through `Xamarin.Mac.msbuild.targets`.
chamons
added a commit
to chamons/xamarin-macios
that referenced
this pull request
Sep 27, 2017
…amarin#2731) - https://bugzilla.xamarin.com/show_bug.cgi?id=59474 - The idea is to force Full and Modern to expand facades the same way. That way, we get the same, working behavior. - f79f2e4 was not sufficient, even though it matched XI, because of the difference between XI (and Modern) and what Full was doing. - Some context: PR xamarin#2685 And that was problematic because it was expanding the netstandard facades from `Microsoft.NET.Build.Extensions` in the `ImplicitlyExpandNETStandardFacades` target. But we want to build against XM's bundled facades *only*. So we disable the ns facades completely by setting `$(ImplicitlyExpandNETStandardFacades) = false`. But now we are in the situation where a XM/Full project referencing a ns project might fail to build because of a missing `netstandard.dll` reference! And this same case was fixed for XM/Modern projects in xamarin#2643 . So, we enable the use of that for XM/Full projects too through `Xamarin.Mac.msbuild.targets`.
jonpryor
pushed a commit
to dotnet/android
that referenced
this pull request
Feb 27, 2018
Context: #1154 This PR brings in changes from xamarin/xamarin-macios#2643 and xamarin/xamarin-macios#2731 to improve our .NET Standard support. While this does not fix the packaging problem in #1154 it will give us parity with the iOS code base.
jonpryor
pushed a commit
to dotnet/android
that referenced
this pull request
Feb 27, 2018
Context: #1154 This PR brings in changes from xamarin/xamarin-macios#2643 and xamarin/xamarin-macios#2731 to improve our .NET Standard support. While this does not fix the packaging problem in #1154 it will give us parity with the iOS code base.
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
.The reason is that XI and XM (Modern) projects have
$(TargetFrameworkIdentifier) != .NETFramework
, so targets fromMicrosoft.NET.Build.Extensions
which provide ns2.0 support don't getimported.
ImplicitlyExpandNETStandardFacades
in particular, whichwould have added a reference to
netstandard.dll
.netstandard.dll
gets included as part of the facades expanded byImplicitlyExpandDesignTimeFacades
, but this gets skipped if theproject does not have a
System.Runtime
dependent reference.Instead, we want to expand the facades if any reference depends on
System.Runtime
ORnetstandard
. And for that we scan all thereferences for a
netstandard
dependency using theGetDependsOnNETStandard
task.Partially fixes bxc #58504 .