Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

binding redirect

This is more of a VB2005 and NI-488 question, but hopefully someone might know what is causing it.
 
I get the error message:
One or more dependent assemblies have version conflicts.  Do you want to fix these conflicts by adding binding redirect records in the app.config file?
So, I answered 'yes'. The following line was added to app.config file
<bindingRedirect oldVersion="0.0.0.0-8.0.11.194" newVersion="8.0.11.194"/>
 
Looks to be same. What is the difference?
 
 
 
0 Kudos
Message 1 of 7
(4,942 Views)
This Kb explains why this happens.
Bilal Durrani
NI
0 Kudos
Message 2 of 7
(4,935 Views)
To try to solve it before letting VB2005 add the app.config file,
I had first tried deleting the Reference which apparently was to an older revision of the assembly.
Then I added the Refence to the current revision of the assembly.
That still did not fix the problem.
 
Why doesn't that work?
 
It seemed that changing the app.config file is the only way to go.
 
 
 
0 Kudos
Message 3 of 7
(4,923 Views)
The KB describes this behavior

This warning occurs when the version of NationalInstruments.Common installed on your machine is newer than the version that the project originally referenced. The NationalInstruments.Common assembly is designed to be backward compatible with older versions. The NationalInstruments.Common assembly uses publisher policy to redirect references from older versions to newer versions. Therefore, it is safe to disregard this warning and use the latest version of the NationalInstruments.Common assembly.

To elaborate further...

This warning is new to VS 2005. The same setup existed in VS 2003, but the IDE did not have a warning about this.

Adding an app config file means that if there is a newer common and a new policy file is installed, your application will not be re-directed to use the newer version of common automatically. the config file binds it to a particular version of common. Unlike the other MStudio libraries, we only install one version of common and then install a policy file to automatically redirect applications to use the newer assembly. If you use an app config to bind your application with a particular version of common, when common is updated (it replaces the older versions of common), you're application will generate build errors. To fix this, you will need to update the app config file to refer to the newer common.

This information is documented in the help topic "NET Class Library Versioning for Development and Deployment"

Hope this helps


Bilal Durrani
NI
0 Kudos
Message 4 of 7
(4,902 Views)
I think I am understanding what the KB is saying.
 
My question is why doesn't deleting the reference to the old assembly and then adding a reference to the new assembly that is on my PC to the project file fix the problem?  Why do I have to use a app.config file at all?
0 Kudos
Message 5 of 7
(4,896 Views)
Hi

This occurs because you are using some pre-built measurement studio libraries that were built with a specific version of common. Common is a component that is shared by various other assemblies like mstudio, DAQ, VISA and so on.

So lets say you install measurement studio on a clean machine. Then you have a version of common that the mstudio libraries were built against. But lets say 4 months later, you installed DAQ. Common might have been updated in DAQ. The mstudio controls would still work because common is backwards compatible, but they are still linked against an older version of common. We install a policy file that redirects the assembly to use the newer version. Any library that was using the older version will now use the newest version we installed at run-time.

Visual Studio shows this warning because it looks at the versions of the dependencies for the mstudio libraries and determines some redirection might be necessary. Your project might be using the newest version, but the mstudio components were already built against an older version.



Bilal Durrani
NI
0 Kudos
Message 6 of 7
(4,884 Views)

Thank you for that further explanation.

I am going to print this thread and keep it as a reference.

 

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