This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 52050 - XM 4.5 project with msbuild does not resolve correct mscorlib
Summary: XM 4.5 project with msbuild does not resolve correct mscorlib
Status: VERIFIED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: MSBuild (show other bugs)
Version: Master
Hardware: PC Mac OS
: Normal normal
Target Milestone: 15.2
Assignee: Chris Hamons
URL:
Depends on:
Blocks:
 
Reported: 2017-01-30 20:59 UTC by Chris Hamons
Modified: 2017-05-11 08:50 UTC (History)
7 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Repro project (5.83 KB, application/zip)
2017-03-29 15:58 UTC, Bojan Rajkovic
Details

Description Chris Hamons 2017-01-30 20:59:04 UTC
msbuild gives me:

  Selected target framework: .NETFramework,v4.5; API: Unified
  Added assembly /Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/4.5-api/mscorlib.dll
  Added assembly /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.366/lib/mono/4.5/System.Core.dll

Where xbuild gives me:

  Selected target framework: .NETFramework,v4.5; API: Unified
  Added assembly /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.366/lib/mono/4.5/System.dll
  Added assembly /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.366/lib/mono/4.5/mscorlib.dll
Comment 1 Chris Hamons 2017-02-24 20:21:56 UTC
This is not making 15.1
Comment 2 Chris Hamons 2017-03-15 19:15:43 UTC
Fixed in https://github.com/xamarin/xamarin-macios/pull/1846
Comment 3 Bojan Rajkovic 2017-03-29 15:58:51 UTC
Created attachment 21023 [details]
Repro project

This still seems to be broken for me.

Xamarin.Mac version:

 ✘  brajkovic@Junction  ~/Projects/ReadOnlyTest/ReadOnlyTestMacLib  cat /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version
3.3.0.368

MSBuild /v:diag log: https://gist.github.com/bojanrajkovic/6356b1803002f21ee9ee9069e5834286#file-msbuild-vdiag-log
xbuild /v:diag log: https://gist.github.com/bojanrajkovic/6356b1803002f21ee9ee9069e5834286#file-xbuild-vdiag-log

Repro project is attached. Repro steps:

1. Unzip project.
2. cd ReadOnlyTestMacLib
3. msbuild /v:diagnostic

You'll see the 4.5-api mscorlib.dll being picked up and explicitly added as a /reference to the compiler command line. xbuild doesn't do this.
Comment 4 Bojan Rajkovic 2017-03-29 16:06:28 UTC
Forgot to mention my Mono version:

Mono JIT compiler version 4.8.0 (mono-4.8.0-branch/9d74414 Fri Mar 17 16:02:57 EDT 2017)

I tried the S.R.M fix by way of:

sudo cp /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Roslyn/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/

And that did not help.
Comment 5 Chris Hamons 2017-04-10 18:46:09 UTC
This looks fixed in 3.4 in Alpha.

      _ResolveAssemblyReferenceResolvedFilesAbsolute=
          /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/mscorlib.dll
                  CopyLocal=false
                  FrameworkFile=true
                  FusionName=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                  OriginalItemSpec=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/mscorlib.dll
                  ReferenceSourceTarget=ResolveAssemblyReference
                  ResolvedFrom=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/mscorlib.dll
                  Version=


Please re-open / ping if you are not seeing it.
Comment 6 Roshan Mankani 2017-05-05 08:58:06 UTC
Hello @Chris Hamons 

Can you provide proper step or description for verify this bug.
Comment 7 Chris Hamons 2017-05-05 14:27:34 UTC
- Unzip attached project
- Use msbuild command line to build it with /v:diag
- Find the MMPTask in the log and verify we're calling it with /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5/mscorlib.dll
Comment 8 Gaurav Ganorkar 2017-05-11 08:50:45 UTC
we are now able to see the resolvedFromPath of the mscorlib.dll as mentioned in the Comment 5.

Verified on 7.1 Build 582
xamarin.mac 3.5.0.126


MsBuild gist-https://gist.github.com/saurabh-paunikar/e649432d9bac57534daf016c70bccd3a

Xbuild gist-https://gist.github.com/saurabh-paunikar/4a0dd4e9bebac27c60fa62336aad2feb

Note You need to log in before you can comment on or make changes to this bug.