Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio Application deployment issue "nullreferenceexception" on NI.Common.dll

Solved!
Go to solution

Hi,

 

I have an application built in VS2005/C# and Measurement Studio 8.1(which is for VS2005 and .NET2.0), everything works fine on my development PC, and I built the installer from VS2005, which also works. But when I deployed the app on target machine, the application cannot run and throw a "null reference exception" error on the NI.Common.dll while all other NI dlls seem fine.

The dll modules I used:

NI.Analysis.Enterprise.dll

NI.Common.dll

NI.UI.dll

NI.UI.WindowsForms.dll

 

And the merged module that automatically associated in the setup are:

mstudiocommon.2005.msm

mstudiodesign.2005.msm

mstudioui.2005.msm

mstudiouiwinforms.2005.msm

msvcrt.msm

nimesadll.msm

nimetautils.msm

 

Development and Target PC both runs Windows7, and .NET 2.0, .NET Compact 2.0, and .NET 4.0. The application is set to x86 platform. 

Also I notice that after installation on Target PC, under the program folder, there's no NI.Common.dll while others existed. Attached is the error report from Windows Eventviewer when I try to run the app on the Target PC.

 

Thank you.

0 Kudos
Message 1 of 7
(7,073 Views)

Hello Xinchen,

        What if we manually put the  NI.Common.dll onto the target computer?  this could solve the problem.   Also have you tried deploying to a second computer?    Lets try that and see what happens!

        http://digital.ni.com/public.nsf/allkb/46DE00265283A71586256FC000797682?OpenDocument
        http://digital.ni.com/public.nsf/allkb/BEDA0D4A341FB1C3862572C70045CF40?OpenDocument

 

Daniel

0 Kudos
Message 2 of 7
(7,056 Views)

Hi Daniel,

 

Copying the dll over manually doesn't work. I did try to deploy to other computers, all don't work.

 

But I do notice that it works on my another development PC, which though doesn't have any NI installed right now, but does have many different versions of NI dlls in the GAC(remaining from previous NI product installation I suppose), also another interesting thing is after I uninstalled all un-related version of NI.Common.dll from GAC(leaving the only one used in app: 8.1.20.235), the app stopped working.

Is it possible that VS2005 somehow compiled newer version of NI.Common.dll in the GAC instead of the one I indicate in the application? I did checked the reference settings, and tried to set "local copy" of NI.Common.dll to both true and false and make sure the version is correct. But what happened in that PC is weried.

0 Kudos
Message 3 of 7
(7,052 Views)

Hello,

    Fair enough,  it looks like the installer is not correctly including the NI.Common.dll.   How about before we start trying some super in depth troubleshooting let's repair Measurement Studio on your developing computer and try rebuilding the installer.  this will check a lot of possible smaller errors that may be hiding in your code.   In the mean time I will check my sources and see what additional information I can come up with!

 

    To repair Measurement Studio »  Open Control Panel » Programs and Features » National Instruments Software » Measurement Studio » Repair.

 

Daniel

0 Kudos
Message 4 of 7
(7,049 Views)

Just an update, Repairing the NI Mesaurement Studio didn't work out for me. 

0 Kudos
Message 5 of 7
(7,043 Views)

Another update:

I think my susception was right, I tried to unintall the NI.common.dll in the GAC for version 9.1.20.163(highest version in the GAC, the version I specified in the app is 8.1.20.235), which is not used in this application,and the app crashed immedately. 

I guess somehow the app try to use the highest version of NI.Common.dll no matter what version I specify in the app. (Even the Specific Version property is set to be true). 

 

Any idea how to solve this and make sure the linking is correctly?

0 Kudos
Message 6 of 7
(7,041 Views)
Solution
Accepted by topic author xinchen

Hi Daniel,

 

Problem solved, Turns out my guess was right, the .Common dll always link to the newest version available in the GAC,(policy dll?) no matter which one I specify in the application.

So I just uninstalled all NI related dlls in the GAC, and reinstall the version I am using, and do a recompile, then all worked out.

Thank you for the help.

0 Kudos
Message 7 of 7
(7,035 Views)