Bug 55233 - adding a project reference to a C++ Dynamic Shared Library (Android) project fails
Summary: adding a project reference to a C++ Dynamic Shared Library (Android) project ...
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 8.1 (15.5)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-04-15 09:05 UTC by Henri Manson
Modified: 2018-01-02 18:01 UTC (History)
4 users (show)

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


Attachments
San Andreas referencing a C++ Dynamic Shared Library (74.53 KB, image/png)
2017-04-15 09:05 UTC, Henri Manson
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 55233 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Henri Manson 2017-04-15 09:05:14 UTC
Created attachment 21560 [details]
San Andreas referencing a C++ Dynamic Shared Library

When referencing a C++ Dynamic Shared Library (Android) a warning appears: "The project 'SanAngelesLibrary' cannot be referenced. An assembly must have a 'dll' or 'exe' extension in order to be referenced." and the .apk is build without the .so. According to https://developer.xamarin.com/guides/android/advanced_topics/using_native_libraries/#Debugging_Native_Code_with_Visual_Studio_2015 this should be possible.

References:
https://forums.xamarin.com/discussion/79944/adding-native-library-c-project-to-android-app-for-debugging
Comment 1 Mark McLemore 2017-06-23 20:10:26 UTC
Thank you for taking the time to submit this bug. We are unable to reproduce this issue using the latest version of Visual Studio (Version 15.2). Can you update to Visual Studio 2017 (15.2) and try it again?  Also, can you let us know which of the solutions within this sample are not building for you (SanAngeles_NativeDebug or SanAngeles_NDK)?
Comment 2 Mark McLemore 2017-06-23 20:23:10 UTC
If you are unable to upgrade to VS 2017, can you apply all updates and verify that Xamarin.Android 7.3.1.2 or later is installed (click Help > About Microsoft Visual Studio and scroll down). Thanks!
Comment 3 Cody Beyer (MSFT) 2017-08-23 21:07:46 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!
Comment 4 Jon Douglas [MSFT] 2018-01-02 18:01:01 UTC
I am reopening this bug as it is still an issue with C++ shared objects and Xamarin.Android.

Here are a few observations:

1. After referencing the Dynamic Shared Library(Shared Object) project to a Xamarin.Android project, the reference will have a yellow triangle indicating a warning in which a warning will make the Visual Studio Error List UI:

"The project 'ProjectName' cannot be referenced. An assembly must have a 'dll' or 'exe' extension in order to be referenced."

2. This warning goes away after reopening the Xamarin.Android project in some fashion such as unloading/reloading or restarting Visual Studio.

It seems the Reference path gets messed up. Here is a scenario:

1. Right after referencing the path to the shared object is empty.

2. When reloading the project, the path is correct: 

C:\Users\dougl\source\repos\App63\x86\Debug\libSharedObject1.so

I would guess something is going on with our targets or the Visual C++ targets causing this warning in the first place. Given the nature of referencing the shared object in a Xamarin.Android project, I would guess our targets first.

Referencing a newly created Developer Community issue:

https://developercommunity.visualstudio.com/content/problem/173999/problem-adding-reference-to-c-dynamic-shared-libra.html