Add a reference to assembly - windows-phone-8.1

I am developing a Cross Platform app with Xamarin.Forms PCL and I want to add Xlabs to my project.
I have read how to implement it here.
I found the following problem. When I try to add this code to "App.cs" in my WinPhone 8.1 project:
var app = new XFormsAppWP();
app.Init(this);
on "Init" (app.Init(this)) I had this problem:
The type 'Application' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
I have a "Quick Fix" option -> Add a reference to assembly System.Windows, Version=2.0.6.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, but when I try to click on it, nothing happens.
In "Reference Manager" (WinPhone project -> Right click -> Add reference) I can't add this reference because I can't found it.
I am using Visual Studio 2015 pro, my project is targeting .NET 4.5 (I tried also with 4.5.2 but I had the same problem).
How can I resolve this problem?

Related

MvvmLight, PCL and System.Runtime

I have a VS2012 solution that contains a Portable Class Library that targets .NET 4.5, Silverlight 5 and Windows Phone 8. This PCL also references MvvmLight (PCL). I then have a Windows Phone 8 project which references this PCL. For the WP8 project I loaded the MvvmLight (PCL) NuGet Package which loaded MvvmLight, MvvmLight.Extras as well as MvvmLight.Platform.WP8.
But, when I compile the WP8 project it complains that I have an indirect reference to "System.Runtime, Version=2.5.19.0". This is true because the PCL project exposes a view model that has the ViewModelBase class as a base class, which in turn requires the System.Runtime.dll.
If I reference the platform specific versions of MvvmLight in the WP8 project, i.e. the MvvmLight NuGet package, then I also have to reference the Microsoft.Bcl.Build package and when I do that I get load more errors referring to Microsoft.Threading.Tasks.Extensions.
I have tried adding the System.Runtime.dll from the Microsoft.Bcl directory, but it does not solve the problem.
Is there something I'm missing or not tried?!?
This is an issue where NuGet is adding binding redirects when it shouldn't. Deleting the binding redirects for System.Runtime (and System.Threading.Tasks if it exists) from the app.config in your WP8 project should fix this.

Referencing ZXing.Net library

I need to reference the ZXing library to scan QR codes in my Windows Phone 8 app.
I have downloaded the ZXing.Net 0.10.0.0 from the following source: http://zxingnet.codeplex.com/
However, whenever i try to add a reference to zxing.wp8.0.dll, I get an error as follows:
A reference to higher version or incompatible assembly cannot be added
to the project.
Can I please know why am I getting this error. Is there anything that I am doing wrong or missing?
Right click on the DLL in File Explorer --> Click Properties --> Choose unblock. Then try to add a reference again.
VS2012 has the absolute worst error message for when DLLs are blocked due to the fact they were downloaded from the web.
Goto
http://nuget.org/packages/ZXing.Net
Follow the instructions to install the right version you need.

Support multiple assemblies on ASP.NET\C# projects

We're developing a ASP.NET application and having some problems with integration with a MS dll (Microsoft.AnalysisServices)?
The original project was linked to the dll which came with SQLServer2005 (Version=9.0.242.0). After migrating to SQLServer2008R2 (version=10.0.0.0) we encountered this problem:
Could not load file or assembly 'Microsoft.AnalysisServices,
Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. The system cannot find the file
specified.
This is understood since we compile the project with one version and then another version is located on the server. After installing SQLServer2008R2 on the development machine the problem was fixed.
However we now have another problem that we need to support both SQLServer2005 and SQLServer2008R2 environments. I know that we can redirect the search path for the dll using a config file (that it will search for a different version that what it was compiled with), but I can't seem to find instructions how to use it for Web Application (on w3wp). We tried to use "Specific Version"=false, but since this is a "Strong Name" assembly it doesn't work as one would think.
The relevant link which I found is this:
http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/47d0b992-3c10-4851-b2a5-9f72d2c0976e
Can someone please direct me to a link for solving this issue?
Update: I guess I didn't test it correctly since it doesn't work for other servers in SQLServer2008 R2. I guess you can't use range in the newVersion element. So the question is still opened for everyone! . Bottom line is that I know that I have version 9.0.242.0 but the customers version may be either 9.0.242.0 or 10.0.0.0. Is there a method which I can dynamically choose the correct assembly on the production server
You can hook into AppDomain.CurrentDomain.AssemblyResolve and load the assembly you want. If you return null it will look for it normally.
eg.
AppDomain.CurrentDomain.AssemblyResolve += Resolve;
private static Assembly Resolve(object source, ResolveEventArgs args)
{
if (args.Name.StartsWith("Microsoft.AnalysisServices,"))
return Assembly.LoadFile("Microsoft.AnalysisServices.dll");
return null;
}
Try adding a bindingRedirect to your web.config.

Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5

The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include System.Data.Objects, but now my views.
I am using MVC 4, my project was upgraded from MVC 3.
Entity Framework is version 5.
I have a controller that is able to use objectcontext from System.Data.Objects.
My Usings:
using System.Data.Objects;
using System.Data.Entity;
When I try to include the using in the view form System.Data.Objects, I get :
CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I am targeting .net 4.5
My Build Displays this message:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
You can build your solution in diagnostic mode to get more detailed information about the error.
Open the VS Options dialog (Tools > Options), navigate to the "Projects and Solutions" node and select "Build and Run". Change the MS Build project build output verbosity to Diagnostic.
Have a look here.
If you look at the build message, it states the 4.0 version of the .net framework is referenced... Is there a setting in your project file or web/app.config specifying a conflicting version of the .net framework?
Are you familiar with fuslog? you can set it up to log all assembly bindings that .net is doing while running your application. You should then be able to see detailed information on what is getting bound when. If you still can't figure it out, you can always do a binding redirect on that .dll in the web.config.
http://msdn.microsoft.com/en-us/library/eftw1fys.aspx -- binding redirects
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx -- fusion log viewer
Set up fusion logger and take a look at what the output is. If you don't get an answer from that, try the binding redirect (which would give you at least a temporary solution).
In the directory I was publishing to, there was a folder named aspnet_client. I moved it (instead of deleting it), republished, and it worked. I'm not sure why that folder decided to give me trouble out of the blue.

VerifyError: Error #1014: class could not be found

I'm developing AS3 project using Flash Builder 4.5 (also with library Away3D 4.0 and Flex 4.5.1 SDK).
Also, I add my own SWC library, which I compile previously into my project.
It works find if I import class in my SWC library, however I want my swf run in a stand-alone flash player 11.
I follow this tutorial:
http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-4dd43be212e8f90c222-7ffb.html
Now, I could run my app in a flash player 11, but I got an error in run time:
VerifyError: Error #1014: XXX class could not be found
And XXX is my class in SWC library. How should I fix this?
Merged into code means this, in project properties -> Flex Build Path -> Library Path -> Framework Linkage. Framework lingage has two options Merged into code and RSL. Chose Merged into code. This should solve your problem.
We had this problem when trying to build a project using a Native Extension.
Classes within the NE weren't being found at runtime, but were accessible in Flash Builder.
It turned out that by default the .ANE file wasn't copied to the device.
To fix this, change the following project property:
ActionScript Build Packaging -> Apple iOS -> Native Extensions -> Check 'Package' for the ANE
No idea why it wasn't included by default. When you uncheck 'Package' you get a warning telling you that it may cause runtime issues!
In my case, we had a nested reference to the same library which needed to load before the other library also using it. This fix can be accomplished by unchecking the 'Automatically determine library ordering based on dependencies' and moving the library up in the chain of Build path libraries. Flash Builder was unable to determine the correct order base on dependencies because we had 2 different versions of the same library. The error would only happen during run time.
I had this problem after installing AIR 3.9 and trying to upgrade a project.
It was also saying there was an RSL error, before throwing a succession of #1014 errors.
It worked after I set the textLayout.swc link type in Advanced ActionScript Settings to 'merged into code' instead of the default (RSL)
Hope this helps!
Since I landed on this page searching for this error message and none of the above solutions worked for me, here's how I finally managed to work around it:
It seems that this error happens particularly when you include old libraries that were compiled with the old compiler but compile your app with the new one. Unfortunately the error sometimes fires and when you compile again it doesn't; at other times it works fine in the debug version but then it fails in the release.
What worked for me is to include dummy objects in your main app which are instances of the class that the verify error complains about:
import some.classpath.to.TheClassThatFailsOnVerify;
function YourMainApp(){
var dummy:TheClassThatFailsOnVerify = new TheClassThatFailsOnVerify ();
}
At least in my case the errors only fired for classes that were not used directly in the app but only internally in the swc library code, so by having the dummy objects in the main app I force Flash Builder to include those classes in the compilation.
In some cases you might have to first find the swc that contains the class in question since it's not part of the library swc you use but it's again a library that that swc uses itself.