08-14-2009 09:18 AM
I have a Visual Studio 2008 C# project that targets the .Net 2.0 framework. I have upgraded to Measurement Studio 8.6. When I install onto a test computer that only has .Net 2.0 installed the program will not run because nationalinstruments.common is not found even though it is in the GAC. I installed the .Net 3.5 runtimes on the test computer and the program worked as expected. The problem I have is that I am deploying this application on devices running Windows XP Embedded and that only supports .Net 2.0.
Is there a fix for this or do I have to go back to Measurement Studio 8.1?
Thanks!
08-14-2009 01:54 PM
Since I'm using MS Visual Studio 2005 and Measurement Studio 8.6 I doubt there is a problem with creating .Net 2.0 projects using this version of Measurement Studio. I know that VS 2008 can create .Net 2.0 projects as a boost for those using the new development system that need to maintain old projects and .Net 2 code. You may have to check to make sure the project actually was setup as a .Net 2.0 project in VS 2008 since the only other option would be to go back to the last version of Visual Studio.
I've used VS 2005 for the last couple of years and since I get whatever the 'corporate standard development platform' is I'm likely to be using it for quite a while.
08-14-2009 02:49 PM
The Runtime Version in the properties of the NationalInstruments.Common reference shows it was compiled against v2.0.50727. The projects target framework is still .Net 2.0. At first I thought when I updated I went from 8.1 to 8.6.1 and skipped 8.5 but I actually went from 8.5 to 8.6.1 and skipped 8.6. So it appears that 8.5 was working. I tried un-installing 8.6.1 and going back to 8.5 and I get the same results of file not found error for nationalinstruments.common.
I guess I do not understand why I get a file not found error even though the file is in c:\windows\assembly?
08-17-2009 08:59 AM - edited 08-17-2009 09:00 AM
pbrand -
There are several issue wrapped up in this thread:
Why you might be getting an assembly not found error even though the assembly is in the GAC
We have separate copies of Common for targeting Framework 2.0 and Framework 3.5. We encode the version number of the Framework that we target in the third segment of the version number. For example,
NationalInstruments.Common with a version number of 8.6.35.131 supports .NET Framework 3.5
NationalInstruments.Common with a version number of 8.6.20.131 supports .NET Framework 2.0
We also give the 2.0 and 3.5 assemblies different public keys, to allow us to support this scheme and use policy files. In your case, your project might be referencing the 3.5 version of Common, which can't be loaded on a machine without .NET Framework 3.5.
CLR version 2.0.50727
Both .NET Framework 2.0 and .NET Framework 3.5 use this same version of the Common Language Runtime. That is, .NET Framework 3.5 uses the same underlying Runtime as 2.0. It just has some new and revised libraries. MStudio uses these new and revised libraries, so we need to have different versions of our product to support each version of the .NET Framework (even though the underlying CLR is the same).
Using MStudio in VS2008 projects that target Framework 2.0
To use MStudio in a VS2008 project that targets Framework 2.0, you need to install MStudio for VS2005 and manually reference those assemblies instead of the assemblies installed with MStudio for VS2008. Please see my posts on 7/29 and 7/30, in this thread - http://forums.ni.com/ni/board/message?board.id=232&message.id=8912#M8912 - for more information.
David Rohacek
National Instruments
08-17-2009 09:13 AM
08-17-2009 10:28 AM
What is interesting is that I looked at one of the test installs that works and it has 8.5.35.220 of the NationalInstruments.UL dlls in the app folder and version 8.5.35.149 of NationalInstruments.Common and .Common.Native in windows\assembly. There are no 8.5.20.nnn versions installed and being that its Windows XP Embedded there is not .net 3.5 installed.
Would it be ok to install MS 8.6.1 for VS2005 and then install again for VS2008? Would this allow me to use either 2.0 or 3.5 versions as long as I reference them manually as you describe in the posts you linked to?
Thanks.
08-17-2009 02:53 PM
I installed Measurement Studio 8.6.1 for VS 2005 and then for VS2008. I selected the 8.6.20.nnn components (NationalInstruments.Common, .UI, and .WindowsForms) and rebuilt my setup project. I was able to run the app successfully on a test vm.
I did get 2 warnings when building the setup project:
Warning 1 Unable to find module dependency with signature 'CRT.98CB24AD_52FB_DB5F_FF1F_C8B3B9A1E18E'
Warning 2 Unable to find module dependency with signature 'ATL.97F81AF1_0E47_DC99_FF1F_C8B3B9A1E18E'
I tried adding the merge modules Microsoft_VC90_ATL_x86.msm and Microsoft_VC90_CRT_x86.msm to the setup project but the warnings still persisted.
Unfortunately now, when I try to run the application from within VS2008 I get the following error:
"Could not load file or assembly 'NationalInstruments.UI, Version=8.6.20.465, Culture=neutral, PublicKeyToken=4544464cdeaab541' or one of its dependencies. An attempt was made to load a program with an incorrect format."
08-17-2009 04:57 PM
At this point I have decided to upgrade to Windows Embedded Standard which does support .net 3.5 so I should be OK once I get to that point. But I am stuck now where when I run my app on the development computer it can not find NationalInstruments.UI 8.6.35.435. What I did was uninstall all of Measurement Studio, deleted any NI stuff from c:\windows\assembly, c:\program files\, and registry. I then installed Measurement Studio 8.6.1 for VS 2008 only but still get file now found!
I created a simple windows form application (targeting .Net 3.5) and added a waveformGraph to it. I used the Measurement Studio menu to add "Windows Forms User Interface Control Library" to it which added references to .Common, .UI, and .UI.WindowsForms. i attempt to run and receive this error:
"Could not load file or assembly 'NationalInstruments.UI, Version=8.6.35.465, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. The system cannot find the file specified.":"NationalInstruments.UI, Version=8.6.35.465, Culture=neutral, PublicKeyToken=18cbae0f9955702a".
The licenses.licx file is correctly created. Is there some kind of program which will completely remove all NI components so I can install a fresh copy?
08-18-2009 07:57 AM