ILMerge Error Windows Phone 8 Unresolved assembly reference - windows-phone-8

I am trying to merge some .net assemblies for Windows Phone 8 using ILMerge.exe (2.12.0803). On their own all assemblies work fine. I can successfully merge assembles which do not contain references to the Windows.Networking namespace as follows:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
As soon as I try to include a DLL which uses the Windows.Networking namspace as follows:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
.\%1\RemoteTools.dll
I am recieving the following exception:
An exception occurred during merging: Unresolved assembly reference
not allowed: Windows. at
System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly) at
System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type) at
System.Compiler.Ir2md.VisitReferencedType(TypeNode type) at
System.Compiler.Ir2md.VisitClass(Class Class) at
System.Compiler.Ir2md.VisitModule(Module module) at
System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
at System.Compiler.Ir2md.WritePE(Module module, String
debugSymbolsLocation, BinaryWriter writer) at
System.Compiler.Writer.WritePE(String location, Boolean
writeDebugSymbols, Module module, Boolean delayS ign, String
keyFileName, String keyName) at
System.Compiler.Writer.WritePE(CompilerParameters compilerParameters,
Module module) at ILMerging.ILMerge.Merge() at
ILMerging.ILMerge.Main(String[] args)
Having done some reading this exception suggets ILMerge is unable to locate the Windows.Networking assemblies. I have attempted adding various different flags to ILMERGE including:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0" /targetplatform:v4,"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
.\%1\RemoteTools.dll
But still get the same exception. If anyone has any suggestions that would be greatly appreciated.

I don't think ILMerge actually works with other than pure .NET assemblies, especially when Windows Phone 8 and WinRT projects uses referenced native libraries - that might be that not found "Windows" unresolved assembly.

The error indicates that ILMerge cannot find the platform's Windows.winmd. When compiling a Windows Phone or Windows Store project, you compile against two main things; The Platform SDK (WinRT) and a .NET SDK. Any tools that run over these assemblies will need both.
In addition to passing the .NET assembly folder, try passing "C:\Program Files (x86)\Windows Phone Kits\8.0\Windows Metadata directory" as a lib argument.
Make note, ILMerge is based on an older version of CCI (http://ccimetadata.codeplex.com/) so even after doing above, may still have trouble consuming the WinRT metadata format which is slightly different to .NET's.

Related

java.lang.UnsatisfiedLinkError: com.chrysalisits.crypto.LunaAPI.Initialize()V

I am getting below exception while running my application.
Caused by: java.lang.UnsatisfiedLinkError:
com.chrysalisits.crypto.LunaAPI.Initialize()V
at com.chrysalisits.crypto.LunaAPI.Initialize(Native Method)
at com.chrysalisits.crypto.LunaTokenManager.(LunaTokenManager.java:107)
at com.chrysalisits.crypto.LunaTokenManager.getInstance(LunaTokenManager.java:62)
I have added LunaProvider.jar and libLunaAPI in $JAVA_HOME/jre/lib/ext.
I strongly recommend that you ask the HSM Support Team for help on this instead of Stackoverflow.
This error comes up if Java is not able to find the concerned .so / .dll (Library) file. Also, make sure that you have the correct 32 / 64 Bit version of the Library in the location.
That said, in the VM Arguments you could also set :
-Djava.library.path=/location_to_the_libLunaAPI_so_file (possibly, /usr/lunasa/JSP/lib .. or something)
I have solved my problem.
Actual Problem was mismatch between native client library (libLunaAPI.so) and Luna client.
My application was using old library's com.chrysalisits.crypto.* classes to interact with Luna client however my Luna client got updated and functions which it exposed in its native library was not present in current library.
I updated my client application by using com.safenetinc.luna.* classes and latest client library.

Unable to undrestand IKVM exception

I have some java code converted to .net assemblies using IKVM.
When ever I run the application, it throws an exception as below:
The type initializer for '1' threw an exception.
{"Method not found: 'System.Exception java.lang.Throwable.__<map>(System.Exception, System.Type, Boolean)'."}
What I am missing?
After a couple of hours, I could figure out the problem.
The IKVM version that made .net assemblies is important. higher versions which I got from Nuget did not work properly. I had to download IKVM version 0.42.0.3

IBehavior and Caliburn Micro, references

Im building Windows Universal app (for windows phone) and im trying to use behaviors. The app uses Caliburn micro 2.0 framework.
Behavior is like this:
public class ProgressIndicatorBehavior : DependencyObject, IBehavior
{
...
}
In my view, I use the behavior like this:
xmlns:i="using:Microsoft.Xaml.Interactivity"
<i:Interaction.Behaviors>
<behaviors:ProgressIndicatorBehavior IsVisible="{Binding IsLoading}/>
</i:Interaction.Behaviors>
When I try to build this app, I get the following error:
Error 2 The type 'Microsoft.Xaml.Interactivity.IBehavior' exists in
both 'c:\Program Files (x86)\Microsoft
SDKs\WindowsPhoneApp\v8.1\ExtensionSDKs\BehaviorsXamlSDKManaged\12.0\References\CommonConfiguration\Neutral\Microsoft.Xaml.Interactivity.dll'
and 'c:\Program Files (x86)\Microsoft
SDKs\Windows\v8.1\ExtensionSDKs\BehaviorsXamlSDKNative\12.0\References\CommonConfiguration\Neutral\Microsoft.Xaml.Interactivity.winmd' ...
How should I set the app references, right now I have added Behaviors SDK, Microsoft.Xaml.Interactions and Microsoft.Xaml.Interactivity.
completely skimmed over your problem. The 2 Microsoft.XAML.* files are the behaviors.. Remove the reference to Behavior SDK and you should be good.!

WP8: can't consume a native component

Windows Phone 8 C# project (MyApp), migrated from WP7.1. I've added a native Windows Runtime component library (AppLib) to the solution, created a reference. There's a public sealed ref class (MyClass) in it. There's a reference to it in the C# code (in OnLoaded of the main XAML page). The whole thing compiles - meaning the metadata of the component is being generated.
When I'm trying to run, the project fails with the exception or type TypeLoadException with the following message:
Typename or Namespace was not found in metadata file. (Exception from HRESULT: 0x8000000F)
Both AppLib.DLL and AppLib.winmd can be found in the XAP. The winmd contains the information about the type, and in the right namespace, too. What else should I check?
At exception time, the AppLib.dll is not listed in the modules window of the debugger. It's as if the DLL loading fails for some reason.
I've tried with brand new class in an arbitrary namespace - same problem. Looks like the problem is on the DLL level, not on class level.
The name of the WinMD file must be a prefix of the name of the namespace in which any public and activatable types are declared. For example, if your WinMD is named AppLib.winmd, your MyClass type must be defined in namespace AppLib or some other namespace nested within that namespace, for example AppLib::Something.
It must also be declared in the "best matching" WinMD, so if your type is named A.B.MyClass and you have both A.winmd and A.B.winmd in your package, the type must be defined in A.B.winmd.
The Windows Runtime uses the name of the type to determine which WinMD file defines the type. See also my answer to "XAML cannot find reference in local namespace."

method in Report Builder custom assembly not found

I'm trying to use a custom assembly in Report Builder 2.0. I have added the assembly to the report via Report Properties > References. When I try to call a public static method in the assembly, I get this message:
'ExtractTag' is not a member of 'ReportsClassLibrary.ReportsClassLibraryTools'.
The expression I'm trying to use to call the method is:
=ReportsClassLibrary.ReportsClassLibraryTools.ExtractTag("ID", "ID:incorrect", false)
And the method signature in the assembly is:
public static string ExtractTag(string tagToFind, string tags, bool caseSensitive)
That method is within the ReportsClassLibrary namespace and in the ReportsClassLibraryTools class.
I don't know if for some reason my report is looking an older version of the assembly that did not have this method, or if the problem is something else. I've tried removing the assembly from the report, rebuilding the assembly, and re-adding it to the report.
Edit: looks like a deeper problem. My assembly compiles, but when running a test case that calls that method, the test fails with a System.MissingMethodException. Guess I'm having an assembly problem, not a Report Builder problem...
Turned out it was a problem with the Global Assembly Cache in Vista. The old version of my assembly was cached, so the new method ExtractTag wasn't part of the assembly. I had to run:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /i bin\Debug\ReportsClassLibrary.dll