This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 43316 - Native References in iOS Binding projects do not build in VS
Summary: Native References in iOS Binding projects do not build in VS
Status: REOPENED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS (show other bugs)
Version: 4.1.2 (C7SR1)
Hardware: PC Mac OS
: Highest major
Target Milestone: 4.3.1 (C9SR1)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-08-12 16:32 UTC by Bill Holmes
Modified: 2017-02-23 13:20 UTC (History)
16 users (show)

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


Attachments
Solution for testing (30.60 KB, application/zip)
2016-08-12 16:32 UTC, Bill Holmes
Details

Description Bill Holmes 2016-08-12 16:32:15 UTC
Created attachment 17010 [details]
Solution for testing

Open the attached solution file and attempt to build.

Expected Results:
App builds

Actual Results:
The "PrepareNativeReferences" task failed unexpectedly.
Comment 2 Bill Holmes 2016-08-16 19:44:06 UTC
I am 95% sure that I created this in Xamarin Studio.  The latest stable.

Version 6.0.2 (build 73)
Comment 3 Daniel Cazzulino 2016-08-16 20:25:40 UTC
Then they are generating a SLN file in VS2012 format :(
Comment 4 John Miller 2016-08-18 12:52:17 UTC
The solution still reproduces the same issue in VS 2015. Full stack:

The "PrepareNativeReferences" task failed unexpectedly.
System.ArgumentException: Path cannot be the empty string or all whitespace.
   at System.IO.Directory.CreateDirectory(String path)
   at Xamarin.VisualStudio.Build.TaskRunner.WriteEmptyFile(Task task, String file) in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 143
   at Xamarin.VisualStudio.Build.TaskRunner.CreateOutputItem(Task task, ITaskCallback taskCallback, ITaskItem item) in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 131
   at Xamarin.VisualStudio.Build.TaskRunner.CreateOutputItems(Task task, ITaskCallback taskCallback, IEnumerable items) in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 122
   at Xamarin.VisualStudio.Build.TaskRunner.Run(Task task) in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 106
   at Xamarin.iOS.Tasks.PrepareNativeReferences.Execute() in C:\Users\builder\data\lanes\3544\fcbe0828\source\xamarinvs\src\MSBuild\Xamarin.iOS.Tasks\Tasks\PrepareNativeReferences.cs:line 18
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	MyLibFw			

However, I removed the Native Reference in the binding project and re-added using the Add Native Reference menu and now it's build OK.
Comment 5 John Miller 2016-08-18 12:54:32 UTC
In addition to Comment #4, the Output shows that things might not be working as expected:

>------ Build started: Project: MyLibFw, Configuration: Debug Any CPU ------
>  Generated session id: 1056179c54ea1548787829aba6b7efb9
>  Generated build app name: MyLibFw
>  Connecting to Mac server 10.211.55.2...
>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1728,5): warning MSB3341: Could not resolve reference "Native References/MyLibFw.framework". If this reference is required by your code, you may get compilation errors.
>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets(84,3): warning : Access to the path 'C:\TestAdHocApp\MyLibFw\Native References\MyLibFw.framework' is denied.
>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2940,5): warning MSB9004: ManifestResourceWithNoCulture item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='false', Type='Resx', and optional LogicalName.
>  MyLibFw -> C:\TestAdHocApp\MyLibFw\bin\Debug\MyLibFw.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Comment 6 xamarin-release-manager 2016-08-18 16:42:36 UTC
Fixed in version 99.0.0.3416 (master)

Author: Adrian Alonso
Commit: 7b03c8f0d512865b2fed787fb15f98c41b6493c7 (xamarin/XamarinVS)
Comment 7 xamarin-release-manager 2016-08-18 16:47:18 UTC
Fixed in version 4.2.0.543 (cycle8)

Author: Adrian Alonso
Commit: f808eccb48eefb3c380e8f421dadc7cfdd3ba14e (xamarin/XamarinVS)
Comment 8 Danish Akhtar 2016-09-15 06:47:49 UTC
I have checked this issue with latest master XVS 99.0.0.3568 and with C8 XVS 4.2.0.680 and observed that I am still getting this issue, getting an error message while building the attached solution in VS.

Hence Reopening this issue.

Build output: https://gist.github.com/atin360/7cbd50bc32a6bb2b7884cc888750ad59
error: https://gist.github.com/atin360/41b3f66225bb580dc47d0367204aacb1
Env info: https://gist.github.com/atin360/41b3f66225bb580dc47d0367204aacb1
Comment 12 xamarin-release-manager 2016-10-14 14:25:21 UTC
Fixed in version 4.3.0.61 (master)

Author: Jose Gallardo
Commit: 12199db353f08b49df6e23c23380f95402dac063 (xamarin/XamarinVS)
Comment 13 xamarin-release-manager 2016-10-14 14:25:36 UTC
Fixed in version 4.2.1.2 (cycle8)

Author: Jose Gallardo
Commit: 7ed0cc84a943d0b27292c224b55563acb99c81ff (xamarin/XamarinVS)
Comment 14 Sunil Kumar 2016-10-14 18:59:11 UTC
I have checked this issue with C8 Xamarin.VisualStudio_4.2.1.2_7ed0cc84a943d0b27292c224b55563acb99c81ff + xamarin.ios-10.0.2.2_ec01be03ba39338126a43196be1f15c5bba81734 and with latest Master Xamarin.VisualStudio_4.3.0.61_12199db353f08b49df6e23c23380f95402dac063 + xamarin.ios-10.1.0.184_2c950a84ea9275f4b61302adaacc37c9fb594d69 and observed that now attached sample builds successfully without any error.

Screencast(C8): http://www.screencast.com/t/Hpm37kEFzV
Screencast(Master): http://www.screencast.com/t/WBXbeasFJr

Hence closing this issue.

Environment info:
Cycle 8: https://gist.github.com/Prashant360/0faab40fa363c29bea48d6996f832bb2
Master: https://gist.github.com/Prashant360/d4c3b88a20e3eafeeea135dbcf4ff1ac
Comment 15 Joao Silva 2016-11-02 17:41:49 UTC
1>------ Build started: Project: MyLibFw, Configuration: Debug Any CPU ------
1>  Generated session id: dd61f7490a18d66afe2e24fa6a9c7d37
1>  Generated build app name: MyLibFw
1>  Connecting to Mac server 10.200.40.128...
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1728,5): warning MSB3341: Could not resolve reference "MyLibFw.framework". If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2940,5): warning MSB9004: ManifestResourceWithNoCulture item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='false', Type='Resx', and optional LogicalName.
1>  MyLibFw -> D:\Examples\TestAdHocApp\TestAdHocApp\MyLibFw\bin\Debug\MyLibFw.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

This isn't fixed and I can't release my product because I can't add an essencial SDK to it.
Comment 16 Joao Silva 2016-11-02 17:44:40 UTC
Forgot this, sorry.
Doesn't work on stable nor on beta channels:

Xamarin   4.2.1.52 (76d5fac)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.2.37 (ce955cc)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.2.1.4 (316e533)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 17 Simon Chopin 2017-02-03 09:13:32 UTC
Still doesn't work. ALso, I noted the size of my .a archive is down to 0 after the first build attempt.

The reference was first introduced in a Xamarin Studio Mac environment, where it builds correctly. I have tried removing in on VS and adding it back again, to no avail.

The status of this bug needs to be changed to reflect.

Versions:

Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Xamarin   4.2.2.11 (00fa5cc)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.2.42 (501e63c)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.3.1.8 (7beaef4)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 18 John Miller 2017-02-03 14:11:44 UTC
@Joao and @Simon,

I'll reopen the bug report. Can you provide a sample project and diagnostic build output for something that does not work? 

Thanks!
Comment 19 Lyndon Hughey 2017-02-17 15:34:59 UTC
I'm having the same problem with another solution.  I'm receiving the same error messages, and the size of my .a file is 0 bytes.

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Xamarin   4.2.2.11 (00fa5cc)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.2.42 (501e63c)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.3.1.8 (7beaef4)

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