LabWindows/CVI Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
hnesmith

Provide Functions to Programmatically Interact with the GAC

Status: New

Easy integration of MS .NET libraries is a highlighted feature LabWindows/CVI. However, programmatically interacting with the GAC from LabWindows/CVI is currently challenging and more worthwhile to do in other environments. A set of functions to programmatically interact with the GAC from LabWindows/CVI would create a more seamless experience for developers.  

1 Comment
Pete_Cooper@Genie_Industries
Member

I was able to create a Visual C++ (unmanaged) DLL that enumerated through the GAC (Global Access Cache) looking for .Net assemblies that were already registered with the GAC. The DLL function just looked for a particular assembly that I created to make sure it was already registered.

 

From there I was able to call this DLL from Lab Windows CVI to indicate if the assembly was registered. If the assembly was not registered, I called the Lab Windows CVI function: "CDotNetRegisterAssemblyPath" to register the assembly path.

 

If the assembly was not registered and assembly is in a different path than the executable created by Lab Windows CVI that calls the .Net method written in C#, Lab Windows CVI Runtime engine reports a fatal runtime error. This is why I had to create this DLL to determine if the assembly was registered. In the production code I want my assemblies to be registered with the GAC.

 

I used the fusion.dll that comes with Visual Studio 2010/2012 that allowed me to interact with the GAC for unmanaged code. The fusion.dll is COM based so Lab Windows CVi cannot call COM based functions directly. There is a fusion.h in the Lab Windows CVI  SDK folder but there is no supporting documention for the fusion.h file on how to call the functions from Lab Windows CVI since it looks like the calls are COM based. Lab Windows CVI cannot even use the Lab Windows CVI Active X Controller to access the fusion.dll.

 

It looks like Lab Windows CVI IDE 2012/2013 uses the fusion.dll to access the GAC when one selects the .Net Controller menu item. The .Net Controller displays all the assemblies that are registered with the GAC. Lab Windows CVI does not provide any functions to interact with the GAC.