Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid reference of NationalInstruments.Common assembly

Hi,

I'm using Measurement Studio 2012 with Visual Studio 2010 for the development of a .NET 4.0 WinForms application in C#.
My application contains a WaveFormGraph control and some other UI controls of Measurement Studio.
Everything works fine on a machine where Measurement Studio is installed.
But when I try to deploy my application to another computer (via setup project) an exception error will occur immediately after starting the application.

The exception indicates that the assembly "NationalInstruments.Common, Version=12.0.40.253, Culture=neutral, PublicKeyToken=dc6ad606294fc298" is not found.
Stack trace:
    GraphForm.InitializeComponent()
    GraphForm..ctor()
    ...
    Program.Main()

 

 

Actually, there is version 12.0.40.258 of the NationalInstruments.Common assembly referenced in my Visual Studio project and I can not even find the older version 12.0.40.253 on my hard disk.

I also analyzed my executable with a .NET Reflector and found out that there are two different versions of NationalInstruments.Common assembly referenced in it. I checked every setting in Visual Studio and I have no idea where the additional version 12.0.40.253 comes from.

 

 

Then I tried a workaround by adding a binding redirection to app.config:

 

  <configuration>
    <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
   </startup>
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="NationalInstruments.Common" publicKeyToken="dc6ad606294fc298"
                          culture="neutral" />
          <bindingRedirect oldVersion="12.0.40.100-12.0.40.257"
                                  newVersion="12.0.40.258" />
        </dependentAssembly>      
      </assemblyBinding>
    </runtime>
  </configuration>

 

 

This took me one step forward but led me to another exception error caused by type initialization of NationalInstruments.UI.Internal.WaveformPlotElement.

Stack Trace:

   NationalInstruments.UI.Internal.WaveformPlotElement..ctor(ControlElement parent, Object obj)

   NationalInstruments.UI.WaveformPlot.CreateElement()

   NationalInstruments.UI.ControlEntity..ctor()

   NationalInstruments.UI.Plot..ctor()

   NationalInstruments.UI.XYPlot..ctor()

   NationalInstruments.UI.WaveformPlot..ctor()

   GraphForm.InitializeComponent()

   GraphForm..ctor()

   ...

   Program.Main()

 

 

Has anyone an idea what the problem is and how I get my application working on another machine?

Why are there two different versions of one assembly referenced in my application?

 

 

Kind regards,

Tom*S

0 Kudos
Message 1 of 11
(9,039 Views)

Use policy files to ensure compatibility between different versions. This is also used by NI itself.

 

Hope it helps

Christian

0 Kudos
Message 2 of 11
(9,003 Views)

If this is .net 4 related you should try to use

 

<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
</configuration>

 

 

Christian

0 Kudos
Message 3 of 11
(9,000 Views)

Hi Christian,

 

Thank you for your response!

 

There are already some policy files of National Instruments in the application folder which were created by the setup.

Amongst others there are the files:
   policy.9.0.NationalInstruments.Common.dll
   policy.9.1.NationalInstruments.Common.dll
   policy.12.0.NationalInstruments.Common.dll

 

And there's a file named NationalInstruments.Common.config with the following content:

   <configuration>
      <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
      <assemblyIdentity name="NationalInstruments.Common" publicKeyToken="dc6ad606294fc298"
            culture="neutral" />
      <bindingRedirect oldVersion="7.0.0.275-7.1.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="8.0.40.100-8.0.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="8.1.40.100-8.1.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="8.5.40.100-8.5.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="8.6.40.100-8.6.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="8.7.40.100-8.7.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="8.9.40.100-8.9.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="9.0.40.100-9.0.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="9.1.40.100-9.1.40.999"
           newVersion="12.0.40.258" />
      <bindingRedirect oldVersion="12.0.40.100-12.0.40.257"
           newVersion="12.0.40.258" />
       </dependentAssembly>
     </assemblyBinding>
      </runtime>
    </configuration>

 

 

And despite of these files my application is still looking for the additionally referenced assembly version 12.0.40.253.

Without the binding redirection in app.config my application aborts on startup with the exception error indicating this missing assembly version.

 

I also tried your second suggestion but that doesn't seem to fix the problem.

 

 

0 Kudos
Message 4 of 11
(8,988 Views)

Smiley Sad

 

Try to use the fresh released MeasStudio V2013 then Smiley Happy

0 Kudos
Message 5 of 11
(8,984 Views)

The list of bugfixes of the new Measurement Studio 2013 is very short and my issue is not listed there:

http://www.ni.com/white-paper/14476/en

 

So, I think updating to version 2013 will not solve my problem.

But I'm already in contact with the NI support. I hope they can locate the problem and will provide a solution.

0 Kudos
Message 6 of 11
(8,933 Views)

Was this issue ever resolved?  I have the same exact issue where I've just upgraded to 12.0.40.258 but it wants 12.0.40.253 and I cannot find a reference to this anywhere in any of the projects.

0 Kudos
Message 7 of 11
(8,839 Views)

Hi Mohgeroth,

 

Have you tried to remove the references wich are causing the issue? Clean up the references in your project and add it back in, using the newest version of the dlls.

 

Regards

0 Kudos
Message 8 of 11
(8,829 Views)

No, this issue has not been resolved, yet. I was in contact with NI but they couldn't re-produce the problem. And currently, I have no time to do further research work on that issue. I will continue later and if I find a solution I will post it here.

0 Kudos
Message 9 of 11
(8,824 Views)

I know I'm late but for others who may stumble across the same problem,

this helped me out, at least for the NationalInstrumments.Common assembly versioning problem:

 

http://digital.ni.com/public.nsf/websearch/08DE982E36A157E9862578F00062B279?opendocument&Submitted&&...

0 Kudos
Message 10 of 11
(4,611 Views)