-
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] Add reference to System.Drawing.Common.dll
to XI projects.
#6011
[msbuild] Add reference to System.Drawing.Common.dll
to XI projects.
#6011
Conversation
Fixes mono/mono#13483 : ``` @akoeplinger: Since we moved types from Mono.Android.dll and Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects would fail to compile. We need to add some msbuild logic to add a reference to the assembly automatically. ```
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 tested this on iOS, tvOS and watchOS projects, and the fix worked.
I also tested on Xamarin.Mac projects, and the fix didn't work there, so I copied the fix to the corresponding Xamarin.Mac targets file, and that worked, so I pushed the change.
@radical is there any way to for customers to undo/ignore this fix locally (in their csproj) if it ends up causing problems for someone?
This comment has been minimized.
This comment has been minimized.
Build failure Test results2 tests failed, 0 tests skipped, 99 tests passed.Failed tests
|
…s_* tests. We're including a new assembly, which means the Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated accordingly. Also modify these tests so that test assert that fails lists the actual assembly that's missing, i.e. instead of this: 1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable xamarin#1 Expected: 6 But was: 7 we now print: 1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable References Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" > But was: < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
I think we should remove our hacks so we'll have an earlier warning is it breaks.
|
…owReference_ToSystemDrawing. The test was verifying that referencing System.Drawing.dll and trying to use System.Drawing.RectangleF would fail to compile (because System.Drawing.dll shouldn't be resolved in this case). The addition of System.Drawing.Common.dll breaks this assumption, because now we ship System.Drawing.RectangleF, so the code that was supposed to fail to compile works just fine instead. So modify the test to verify that there's no System.Drawing.dll in the final bundle.
Good point, I've removed them. |
@rolfbjarne Not as is, but this could be made conditional on some new property that the user can set to disable this behavior. |
bot issues
|
build |
Build failure Test results6 tests failed, 0 tests skipped, 228 tests passed.Failed tests
|
…g.Common.dll causes problems.
|
Ok, I've added a |
@@ -458,6 +458,13 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. | |||
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="@(_IpaPackageFile)" /> | |||
</Target> | |||
|
|||
<Target Name="_AddExtraReferences" BeforeTargets="ResolveAssemblyReferences" Condition="'$(DisableAutomaticSystemDrawingCommonReference)' == ''"> |
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.
Same thing than in the Mac common targets
@@ -186,6 +186,13 @@ Copyright (C) 2014 Xamarin. All rights reserved. | |||
<RemoveDir Directories="$(IntermediateOutputPath)" /> | |||
</Target> | |||
|
|||
<Target Name="_AddExtraReferences" BeforeTargets="ResolveAssemblyReferences" Condition="'$(DisableAutomaticSystemDrawingCommonReference)' == ''"> |
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 think DisableAutomaticSystemDrawingCommonReference
should have a generic name to match the target name like DisableExtraReferences
or DisableAutomaticExtraReferences
.
Besides that, since it's a boolean property it'd be better give it a default value if it's empty (set it to false) or check if it's != 'true', because if someone sets it to false for any reason the target will be skipped when it shouldn't.
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.
@emaf ok, I've changed it to use DisableExtraReferences
and check for (not) true
instead of empty string.
Build success |
@monojenkins backport d16-2 |
Fixes mono/mono#13483 :