The type `System.Xml.XmlElement' is defined in an assembly that is not referenced. Consider adding a reference to assembly System.Xml - mono

I tried to import an external library to my project, but I'm receiving an error:
Error CS0012: The type System.Xml.XmlElement' is defined in an assembly that is not referenced. Consider adding a reference to assemblySystem.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
System.XML (2.0.5.0) is added to the project. What can be the problem?

The problem may be that you are using an 'external library'
Is this a library that has been built for Xamarin.iOS? Or is it a more conventional .Net assembly.
Because Xamarin.iOS is based originally on Moonlight (which used the Silverlight assemblies), then you cannot just pull in external assemblies - you should recompile these assemblies specifically for Xamarin.iOS

Related

Could not load a dependency of my custom dll exception

I have written a custom data-access library (aka DAL) which references [Microsoft.Practices.EnterpriseLibrary.Data.dll] as a dependency.
When my client app which has a reference to the DAL dll, try to use one of the DAL's methods, an exception is thrown:
Could not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.Data, Version=6.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
If I, of course, put the EnterpriseLibrary dll in my client app bin folder (or make the client reference it...), there is no error, but it's a 'crooked' solution.
What is not clear to me is why referenceing ONLY my custom DAL dll is not enough?
And, is there a way to only reference the DAL dll without referencing EnterpriseLibrary dll's directly?

.Net core MsBuild UsinTask throws System.runtime version=4.1.0.0 or could not load file or one of its dependencies

I am trying to register my own ms build task, but I am getting
The "MyTask" task could not be loaded from the assembly Path/TasksAssembly.dll. Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Does someone runed into this problem? Why does it search for System.Runtime 4.1.0.0?
In the dependencies of Microsoft.Build 15.1.1012 I am seeing System.Runtime 4.3.0.

Service Reference in UWP reusing NetStandard assemblies

In an client/server application I am trying to reuse assemblies targeting NetStandard1.4 in the Server and in an UWP. Communication is done using WCF.
If "Reuse types in referenced assemblies" is unchecked the service references is created. Once I check the option to reuse assemblies I get the following error:
"Custom tool warning: Cannot resolve dependency to assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event."
and warnings saying:
"Custom tool warning: Cannot resolve dependency to assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event."
I found this thread: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5092755b-e1ed-4496-ae6d-74386ebdac98/uwpservice-references-in-universal-apps-and-portable-class-libraries?forum=wpdevelop it is related to PCL and I hope netstandard has overcome that issue.
I have tried importing frameworks in my UWP app:
"frameworks": {
"uap10.0": {
"imports": [ "netstandard1.4", "netstandard1.6.1" ]
}
},
but it didn't work. It seems like I am really close to have it working but I am missing a detail that makes everything work.

system.design reference issue of WixSharp on .net 4

I'm trying to use WixSharp with .net 4, but I got this warning:
Warning The currently targeted framework ".NETFramework,Version=v4.0,Profile=Client" does not include "System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which the referenced assembly "WixSharp, Version=1.0.39.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL" depends on. This caused the referenced assembly to not resolve. To fix this, either (1) change the targeted framework for this project, or (2) remove the referenced assembly from the project.
I checked that System.Design is not referenced. When I tried to add reference to it, it's actually grayed out in add reference dialog.
As a result, just as the warning says, WixSharp is not resolved, and all namespaces in WixSharp has a missing of reference error.
How should I fix this? compile WixSharp from source?
Fei

Why the assembly loader is not checkin the GAC for a C++/CLI mixed mode assembly?

I have a C# project that references a C++/CLI mixed mode assembly. That assembly is stored inside a folder into the PATH and it is also present at the GAC but when it is executed I get a:
System.IO.FileNotFoundException: Could not load file or assembly 'PcsSocketCommunications500, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
The version 0.0.0.0 is because the C++/CLI does not has an Assembly version class but as far as I know this shouldn't be a problem.
Running process monitor I've seen that the system just looks for the assembly at the same folder as the main process ... I'm not an expert of assembly loading but I expected to see at least some GAC searchs and 'maybe' some PATH searchs .. That's what I got (PcsSocketCommunication500.dll is the C++/CLI assembly and in black it's the working directory):
Any idea about why the loader is not checking the GAC or the PATH?
PublicKeyToken=null
The assembly isn't strong named. That means it can't be located in the GAC, the CLR isn't going to look there. Not sure what you did to get in the GAC, but it shouldn't be possible as-is.