Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Installation error: Could not load assembly WindowsForms

I used just one .NET control from Measurement Studio (the LED indicator), and am having trouble creating an installation for my application using InstallShield 12.  When my application is installed on another computer (running Windows 2000) and then launched, my C# Windows Forms application catches an exception and displays it in the exception dialog I wrote:
 
An error has occurred: Could not load file or assembly 'NationalInstruments.UI.WindowsForms, Version=8.0.20.334, Culture=neutral, PublucKeyToken=4544464cdeaab541' or one of its dependencies.  The system cannot find the file specified.
 
By using the list of merge modules on my local help at
ms-help://MS.VSCC.v80/MS.VSIPCC.v80/NI.MeasurementStudio.2005/Deployment/XML/NET_Merge_Modules.html
I have included the following merge modules in my InstallShield installation:
 
NationalInstruments.Common
MStudioCommon.2005.msm 

NationalInstruments.Net
MStudioNet.2005.msm
DataSocketServer.msm
DataSocketCore.msm
logosdll.msm
logosopc.msm
logossc.msm
logossrv.msm
logosusr.msm
ni_utility.msm
ninetbrw.msm
opcenum.msm
NIMesaDLL.msm
NIMSVC_CRT71.msm
NIMSVC_MFC71.msm
NIMSVC_STL71.msm
nimetautils.msm
---
HTML WinHelp.msm
Comcat.msm
Comctl32.msm
Comdlg32.msm
Mfc42.msm
Mscomctl.msm
Msvbvm60.msm
Msvcp60.msm
Msvcrt.msm
oleaut32.msm

NationalInstruments.UI
MStudioUI.2005.msm
NIMesaDLL.msm
nimetautils.msm
MStudioDesign.2005.msm
---
Microsoft_VC80_ATL_x86.msm
Microsoft_VC80_CRT_x86.msm

NationalInstruments.UI.WindowsForms
MStudioUIWinForms.2005.msm
There is one more from that the list says to include, CWUI_OCX.msm, but I cannot locate that anywhere on my hard drive.  And InstallShield gives the error
ISDEV : error -4072: Error retrieving dependency CWUI_OCX.058B041E_15EB_408B_ABBE_88DE9D7604A0:0 of c:\program files\common files\merge modules\DataSocketCore.msm
 
In my C:\WINNT\Assembly directory I can see
NationalInstruments.Common
policy.8.0.NationalInstruments.Common
 
and in my application directory I can see
Accessibility.ni.dll
mscorlib.ni.dll
msvcm80.ni.dll
System.Configuration.ni.dll
System.Drawing.ni.dll
System.ni.dll
System.Web.ni.dll
System.Windows.Forms.ni.dll
System.Xml.ni.dll
 
In particular, NationalInstruments.UI.WindowsForms is not in the Assembly directory of my test computer the way it is on my development computer.
 
I noticed the local help doesn't mention anything about license files.  Do I need to do anything with those in my installation, e.g., with WindowsForms.lic?
 
I also tried my installation on a fairly clean Windows XP computer, and there my C# application doesn't even get the opportunity to catch the exception -- I just get the Windows XP dialog asking me if I want to send a report to Microsoft.
 
The exception message from Windows 2000 that I put at the top of this message is the best clue, and is my real question here: Why can't my application find NationalInstruments.UI.WindowsForms?
 
0 Kudos
Message 1 of 19
(16,190 Views)

Hi Michael,

It looks like you are including quite a few msm files that are probably unnecessary. If you are not using DataSocket, you can exclude all of the NI.Net msm files. Also, you shouldn't need CWUI_OCX.msm. What results do you see if you only include UI msm files?

Don't worry about WindowsForms.lic - it is in embedded into the executable when you build it.

0 Kudos
Message 2 of 19
(16,143 Views)
Upon your suggestion, I removed all the merge modules associated with "NI.Net".  There was no difference.
 
I also tried creating a new test installation from scratch that had just the executable and only the merge modules associated with "NationalInstruments.Common", "NationalInstruments.UI", and "NationalInstruments.WindowsForms".  After that installation, I still don't see NationalInstruments.UI.WindowsForms on my test computer in either the installed application directory or \WINNT\Assembly.
 
Does National Instruments have a working sample InstallShield .ism file I can use as a starting point?
0 Kudos
Message 3 of 19
(16,139 Views)
Hi Michael,

Can you find the assemblies anywhere i
f you search the entire C:\ drive?
0 Kudos
Message 4 of 19
(16,124 Views)

I figured out a way to get the installation to work.  I had to rely upon "XCOPY installation" (into the application directory) for some of the .NET assemblies rather than rely upon the NI merge modules.

The Merge Modules I did keep are:

MStudioCommon.2005.msm

MStudioDesign.2005.msm

MStudioUI.2005.msm

MStudioUIWinforms.2005.msm

niMetaUtils.msm

NIMesaDLL.msm

In addition, I kept a lot of the Microsoft merge modules I listed previously.

The key was to install the following .NET assemblies directly into the application's directory:

mscorlib.ni.dll

msvcm80.ni.dll

System.Configuration.ni.dll

System.Drawing.ni.dll

System.ni.dll

System.Web.ni.dll

System.Windows.Forms.ni.dll

System.Xml.ni.dll

 

0 Kudos
Message 5 of 19
(16,095 Views)

Hi,

I am having the same problem.

I am trying to publish my application so the users can run it from the network. 

When I try to run the application, the following error pops up...

"Unable to install or run the application.  The application requieres thst assembly NationalInstruments.Common Version 8.0.20.334 be installed in the Global Assembly Cache (GAC) first."

Can anyone help me solve this problem?

 

Regards AJ.

0 Kudos
Message 6 of 19
(15,946 Views)
Hi AJ,

You must register assemblies with the GAC (in your case, NationalInstruments.Common found in C:\WINDOWS\assembly on your development machine). This can be accomplished in two ways:
  1. Drag and Drop:
    You can simply drag and drop or copy and paste the assembly DLL file into C:\WINDOWS\assembly. Windows automatically takes care of registering it with the GAC.

  2. Using GACUtil.exe
    You can also register the assembly by using the following command: gacutil /i sample.dll
    • /i is to install the assembly into the GAC

    • /u is to uninstall the assembly from the GAC

Regards,
0 Kudos
Message 7 of 19
(15,918 Views)
Hi James,
You were right.  It works now.  Keep up the good work.
 
Thank you, thank you, thank you.
0 Kudos
Message 8 of 19
(15,904 Views)

Hi James,

I need your help once again...  PLease look at the error bellow.

/*************************


System.IO.FileNotFoundException was unhandled
  Message="Could not load file or assembly 'NationalInstruments.Common, Version=8.0.11.274, Culture=neutral, PublicKeyToken=4544464cdeaab541' or one of its dependencies. The system cannot find the file specified."
  Source="VisaicNS"
  FileName="NationalInstruments.Common, Version=8.0.11.274, Culture=neutral, PublicKeyToken=4544464cdeaab541"
  FusionLog="=== Pre-bind state information ===\r\nLOG: User = US\\08769\r\nLOG: DisplayName = NationalInstruments.Common, Version=8.0.11.274, Culture=neutral, PublicKeyToken=4544464cdeaab541\n (Fully-specified)\r\nLOG: Appbase = file:///C:/Data/08769/Visual Studio 2005/Projects/MAURICIO/NationalInstruments/DotNET/Examples/Visa/VisaicNS/CS/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : NationalInstruments.VisaNS, Version=8.0.11.190, Culture=neutral, PublicKeyToken=4544464cdeaab541.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Publisher policy file is found at C:\\WINDOWS\\assembly\\GAC_MSIL\\policy.8.0.NationalInstruments.Common\\8.0.20.274__4544464cdeaab541\\NationalInstruments.Common.config.\r\nLOG: Post-policy reference: NationalInstruments.Common, Version=8.0.11.274, Culture=neutral, PublicKeyToken=4544464cdeaab541\r\nLOG: Attempting download of new URL file:///C:/Data/08769/Visual Studio 2005/Projects/MAURICIO/NationalInstruments/DotNET/Examples/Visa/VisaicNS/CS/bin/Debug/NationalInstruments.Common.DLL.\r\nLOG: Attempting download of new URL file:///C:/Data/08769/Visual Studio 2005/Projects/MAURICIO/NationalInstruments/DotNET/Examples/Visa/VisaicNS/CS/bin/Debug/NationalInstruments.Common/NationalInstruments.Common.DLL.\r\nLOG: Attempting download of new URL file:///C:/Data/08769/Visual Studio 2005/Projects/MAURICIO/NationalInstruments/DotNET/Examples/Visa/VisaicNS/CS/bin/Debug/NationalInstruments.Common.EXE.\r\nLOG: Attempting download of new URL file:///C:/Data/08769/Visual Studio 2005/Projects/MAURICIO/NationalInstruments/DotNET/Examples/Visa/VisaicNS/CS/bin/Debug/NationalInstruments.Common/NationalInstruments.Common.EXE.\r\n"
  StackTrace:
       at NationalInstruments.Examples.VisaicNS.MainForm.MainForm_Load(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at NationalInstruments.Examples.VisaicNS.MainForm.Main() in C:\Data\08769\Visual Studio 2005\Projects\MAURICIO\NationalInstruments\DotNET\Examples\Visa\VisaicNS\CS\MainForm.cs:line 460
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

************************/

I try reinstalling NI-VISA 4.0, and after that a whole lot of errors started hapening.

Please help, all my programs are stucked, and I can not do any work.

Thank you in advance.

0 Kudos
Message 9 of 19
(15,829 Views)
Hi AJ,

Did you reinstall VISA to fix the above problem or did the problem start occurring when you reinstalled VISA?

Also, what version of NationalInstruments.Common.dll do you see in:
C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Assemblies\Current

(right click and select properties, then select version tab)

Regards,
0 Kudos
Message 10 of 19
(15,814 Views)