My shared library cannot resolve using RestSharp; among other related namespaces. RestSharp is an installed package and is resolvable in the Droid/iOS projects but cannot be found in the Shared Library. I know this works because I'm using RestSharp in a MonoGame project in the same way. The shared library is referenced in the Droid/iOS projects but still fails during compilation.
Any advice? I tried clean all.
Update I created a new Cross Platform Native app solution and I was able to reference in my shared library without issue. That original project is a bit older and was created with PCL originally. I still want to know why it's not working in my original solution.
I continued to have lots of namespace and type not found issues. Once I showed warnings instead of just errors I found that the csproj was missing. After removing the reference in the native apps and re-adding the issue was resolved. Quite frusterating.
Related
I've installed several packages in a Unity (2020) app I'm building. Namely: World Locking Tools, MRTK, PUN2. World Locking Tools provides some examples that are built with assemblies defining scripting symbols that any derived files I want to build would need access to. I'd like to create my own version of certain files from one of these examples. To do this and have access to the scripting symbols in one of those examples, I created an assembly reference to reference the assembly for that example code within World Locking Tools package installed in my project space. In so doing, I kept running into the common "...not found, are you missing an assembly reference" issue, which ultimately led me to creating assembly references for many of the assemblies provided by the various packages I needed to use (not just the particular example code I initially wanted to modify). Once my project finally built successfully in unity, I then tried to upload to a Hololens 2 headset in Visual Studio. This provided the error in the title of this post. Coincidentally, the app also appears to fail to start on the headset. Before I tried to alter my codebase with modified versions of files from that World Locking Tools example and with assembly references, the code would successfully build in Unity and successfully deploy to the Hololens 2 headset.
Does the behavior and missing .pdb error I describe mean that I'm missing assembly references for yet other packages even though Unity successfully builds the project?
This is my first foray into using assemblies so be please be gentle :)
For the .pdb message, that one is ignorable since will not have that symbol available. However, the app not starting is definitely likely due to a missing component or loading issue. When ran in debugger, may get a better idea on what is missing or from a debugger log in Unity.
I am trying to build Xamarin Android binding libraries for two different RFID hand held scanner SDKs (from two different companies), and then reference them in a Xamarin.Android project. So the end goal is to have one application that can run on Device A or Device B and depending on the device manufacturer it will use a different implementation of a "scanner" interface. If I try to reference both of the resulting dlls from the Xamarin.Android project, then I get the following error:
Program type already present: com.hsm.barcode.DecodeOptions
Looking in the jars using JD-GUI as suggested in the Microsoft Docs I can see the problem is that both of the jars have a com.hsm.barcode package:
What is the best way to workaround this issue?
Note that if I use only one of the dlls then I have no issues.
What I have tried:
Using a single Xamarin Android binding library project for both jars - this gave exactly the same result
Renaming all of the classes in the jar to eliminate duplicate class names like this: <attr path="/api/package[#name='com.hsm.barcode']/class[#name='DecodeOptions']" name="name">DecodeOptions2</attr>. When I do this, in reflector I can see that the class name has indeed changed, but I still get the build error when building the Xamarin.Android project
Renaming the namespace in one of the projects: <attr path="/api/package[#name='com.hsm.barcode']" name="name">com.hsm.barcode2</attr>. Again, I can see the updated namespace in reflector but still I get the same "Program type already present" error when building the Xamarin.Android project
Similarly I have tried removing both the namespace and the duplicate classes using remove-node but seen similar results
This leads me to believe that this isn't necessarily an issue with the binding process but rather a more Android related problem. I have found some similar Android questions where people mention that you can use exclude module in gradle to remove dependencies [1] [2], but a) there seems to be no concrete answer that this is the right approach in this case and b) as I have been able to find gradle is not a tool that is used as part of the Xamarin/Visual Studio process.
My final desperate attempt to get something working was to unzip one of the jar files, remove all the .class files that are causing issues, then rezip and use this in the Android binding library and then reference this dll in my Xamarin.Android project. This seems to work (the project builds and runs) but I'm not sure it is the correct/safest/most stable solution.
To summarize, the question is: if you have two jars with duplicated namespaces/packages and you want to use both of these Jars in a Xamarin.Android project how can you avoid the resulting Program type already present: com.hsm.barcode.DecodeOptions error message.
I cannot directly download boost library nor quantlib from sourceforge.net/ due to web control inside company. So I downloaded QuantLib v1.8.1 from github, added linking to boost library v1.60 (I also tried v1.61) which is available in the share folder (I tested, boost library works fine), and tried to build under VS2015 x64-release.
The error message I got was (after processing to errors.cpp):
C2757 'boost': a symbol with this name already exists and therefore this name cannot be used as a namespace name.
I'm wondering if it's due to a setup error? How to fix it?
Thanks.
I have a Xamarin.Forms Shared project.
I need to add a reference to System.Net.Http and after some research I found out it should be done via the regular right click -> select assembly (at every regular project), done that.
But now, if I go to any class on my shared project and try to use that DLL I can't (see image)
What am I doing wrong?
I've added the reference to every other project (iOS, Android and WinPhone) but can't access it on my Shared Project classes.
EDIT
After much try-and-error I figured it out...
I have 3 projects (iOS, Android AND WP8.1).
I was able to add System.Net.Http to iOS and Android projects but when I tried to do that at the WP project I got a message saying all needed DLLs were already in the SDK (how presumptuous!).
Anyway, I decided to unload WP project and it worked =/
So the problem now is: How can I add that DLL to the WP project, since I want to support it, but I NEED System.Net.Http?
Thanks.
You can not add a reference to a project type of SharedProject. Instead you have to add this reference to the project you referenced the SharedProject to.
Consider the following:
You have a solution with a console project and a - lets call it core project - as a SharedProject.
Your console project references core. If you now want to use System.Net.WebClient you have to add the reference to System.Net to the console project.
Well, I figured it out.
The way I solved it was by unloading the WP project and reloading it. Perfect, it worked =)
After reloading the project I checked the .NET for Windows Phone reference and System.Net.Http is indeed there. Maybe this was just a cache thing, I don't know.
All I know is unloading the project and reloading it did the trick.
I've downloaded (cloned the repository) of script# from https://github.com/nikhilk/scriptsharp
Only I can't figure out how to get the source to compile.
I have installed ScriptSharp 0.7.3.0 as it seems to have a dependency on the installed directory to be present in the build.
I have looked around in the source code for some instructions and on google to no success.
Edit
Seems that the Libraries won't compile for me.
In particular the CoreLib is requesting the a reference to 'mscorlib' be added
BTW I really recommend using script# for complex projects with rich web client experiences.
Especially coupled with knockout.js
I had no problem compiling the whole solution. (v 0.7.3) In fact the CoreLib project seems not having any external reference at all. (CoreLib compiles to mscorlib.dll). You could try to download the complete source package again, open and compile the ScriptSharp solution.