Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NI libraries and licenses.licx

Hi
 
I am using Measurement Studio 7.1 and Windows XP.
I want to write a program which uses NI libraries, e.g NationalInstruments.UI.WindowsForms.dll, NationalInstruments.UI.dll.
Now my problem is that i merge the lib's with ILMerge into the .exe but then a
messagebox comes with "Unlicensed Assemblies" .....
I try not to merge the .dll into the .exe and it works.
What can i do?
 
regards
Friedel
0 Kudos
Message 1 of 7
(5,767 Views)

Hello

I have reproduced this problem. At this time I don't know whether this because of the way ilmerge works or because of something in our licensing. I'll file a report for further investigation.

I also wanted to let you know that our .NET assemblies rely on unmanaged libraries as well for 3D styles, analysis and datasocket. If you are using any of the .NET driver libraries, those require system libraries to be installed. So even if you were to merge all the NI .NET libraries, your application would require some external libraries that you would need to distribute. ILMerge works only on managed libraries.

I hope this helps

Bilal Durrani
NI
Message 2 of 7
(5,748 Views)
Hmmm.... do you know another way
to merge the .dll into the .exe? Or another
tool?
 
regards
Friedel
0 Kudos
Message 3 of 7
(5,737 Views)

The main idea behind this is that the dependency assemblies are added to the application as assembly manifest resources. Then the application would add an event handler for the AppDomain's AssemblyResolve event and if the assembly to resolve was one of the dependency assemblies, the application would extract the dependency from the assembly manifest resource as a byte array, pass the byte array to an overload of Assembly.Load that takes a byte array, then return the loaded assembly from the event handler (the AssemblyResolve event's type is ResolveEventHandler, which is one of the few event delegate types that breaks the event pattern and returns a value rather than returning void and accepting an EventArgs-derived class).

I have not tried these yet, but here are a couple of useful links for ideas

http://weblogs.asp.net/jdennany/archive/2003/09/24/29035.aspx
http://blogs.msdn.com/grantri/archive/2004/07/07/175745.aspx
http://blogs.msdn.com/grantri/archive/2004/06/01/145724.aspx

Some things to consider
http://blogs.msdn.com/junfeng/archive/2004/11/05/253206.aspx

A free tool (that hasnt been updated in a while so I dont know how well it works)
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b7560d78-7384-41b0-8ddf-820137305e24

A not-so-free tool
http://www.thinstall.com/solutions/net_virtual.php

I hope this helps




Bilal Durrani
NI
Message 4 of 7
(5,722 Views)

Thank you very much.

I will try it. Hope this will fix my problems.

 Regards

Friedel

0 Kudos
Message 5 of 7
(5,679 Views)
Hello

There is another problem related to ilmerge:

I'm not able to include libraries containing licensed NI components in ilmerge.
If I do nevertheless, the components constructor throws a license exception at runtime Robot Sad (trace is attached at the end of this post)

I'm using Measurement Studio 8 with Visual Studio 2005 and don't have any problems beside this one.

Is there a solution?

Regards,
Christian


Stack trace:

   at NationalInstruments.Restricted.LicenseBase.ShowUnLicensedBehavior(Type type, Object instance)
   at NationalInstruments.Restricted.LicenseBase.a(Type , Object , String )
   at NationalInstruments.Restricted.LicenseBase.RunTimeCheck(LicenseContext context, Type type, Object instance)
   at NationalInstruments.Restricted.LicenseProviderBase.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
   at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
   at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
   at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
   at NationalInstruments.UI.WindowsForms.Led..ctor()
   at LicenseILMerge.Form1.InitializeComponent() in C:\Dokumente und Einstellungen\chm\Eigene Dateien\Visual Studio 2005\Projects\LicenseILMerge\1\Form1.Designer.cs:line 31
   at LicenseILMerge.Form1..ctor() in C:\Dokumente und Einstellungen\chm\Eigene Dateien\Visual Studio 2005\Projects\LicenseILMerge\1\Form1.cs:line 15
   at LicenseILMerge.Program.Main() in C:\Dokumente und Einstellungen\chm\Eigene Dateien\Visual Studio 2005\Projects\LicenseILMerge\1\Program.cs:line 17
Christian
0 Kudos
Message 6 of 7
(5,475 Views)
ILMerge does not work with licensed assemblies. The author of the tool (see the ILMerge site) mentioned this as a limitation. All the Measurement Studio libraries use the .NET license mechanism and therefore will not work with ILMerge.

Bilal Durrani
NI
0 Kudos
Message 7 of 7
(5,469 Views)