From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ASP.NET missing file assembly for "NationalInstruments.Common" v8.1.20.235

I have a web application that includes NI controls. It works fine on my development computer. But when I upload the published files to the server, it gives the following error:
 
Could not load file or assembly 'NationalInstruments.Common, Version=8.1.20.235, Culture=neutral, PublicKeyToken=4544464cdeaab541' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
 
Notice the version: 8.1.20.235.  I have version 8.1.20.237 in the bin directory. It's a newer version, so it should be backward compatible, especially with only a small version difference.  I tried adding a redirect in the web.config file, but this didn't help (don't know why):

<assemblyIdentity name="NationalInstruments.Common" publicKeyToken="4544464CDEAAB541" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-8.1.20.237" newVersion="8.1.20.237" />

I also tried locating an old version of NationalInstruments.Common.dll (8.1.20.235). Putting this in the bin directory creates the same error except now it asks for version 8.1.20.237. I can't put both versions into the same bin folder, so I can't win.
 
I don't have access to the server beyond the web file structure (i.e. I can't install the files to the server's GAC or change the machine.config file).
 
Any ideas??
0 Kudos
Message 1 of 4
(4,250 Views)
Hi dualtronic,

Editing the web.config file should have worked to force the application to use the specific version of the Common assembly. 

The NationalInstruments.Common.dll uses a publisher policy file to redirect applications to always use the newest version of NationalInstruments.Common.dll installed on the system.  However, if you XCOPY an application without a configuration file and the assemblies included in the application were built with an older version of NationalInstruments.Common.dll, deployment does not work. To ensure the correct configuration file is deployed, you can create an installer that installs the NationalInstruments.Common.dll component. If you do not create an installer, you also can edit the web.config file to redirect the assemblies.  Typically you run a tool, such as Ildasm.exe, on a dependent assembly, such as NationalInstruments.UI or NationalInstruments.UI.WebForms, to determine the older version of NationalInstruments.Common that should be redirected.

Before I give the snippet, I did want to point out that your bindingRedirect statement is not redirecting assemblies since you are using the same version number (i.e. "8.1.20.237").  Instead, you should have a snippet like:

<configuration>
 <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
    <assemblyIdentity name="NationalInstruments.Common">
            publicKeyToken="4544464cdeaab541"
            culture="neutral" />
   <bindingRedirect oldVersion="8.1.20.235">
            newVersion="8.1.20.237" />
   </dependentAssembly>
  </assemblyBinding
 </runtime>
</configuration>

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 4
(4,235 Views)
Thanks Jonathan,

I'm on the right track. I reinstalled MeasurementStudio 8.1.2, rebuilt my app from a fresh Web Project, and inserted all my forms.  This must have cleared-out the floatsom and jetsom in my project. 
Ildasm.exe showed that NationalInstruments.Analysis.dll requires nianlys.dll in the bin folder. That wasn't easy..

Question: I use a Visual Studio 2005 "Web Project" with code behind (as opposed to a "Web Site"). I cannot build "App_licenses.dll" unless I open it using the "Open Website" menu. In other words, the Measurement Studio menu doesn't give me a way to create the app_license.dll unless I'm in the old "website" view, not the "Web Project".  Is this true? If so, is there any danger of using a web project as opposed to a website? There is no National Instruments template for a Web Project, so I'm not sure it's something that is supported.

Joe


0 Kudos
Message 3 of 4
(4,224 Views)

Hi Joe,

To address your first, implicit question, yes, several of our assemblies do have other file dependencies. We actually explicitly mention which ones in our Deploying Measurement Studio Applications help topic in the NI Measurement Studio Help. Inside that category, there is a section entitled Measurement Studio .NET XCOPY Deployment Files that displays a table which shows you file dependencies.  Make sure to review this list when deploying to ensure that all the correct files are deployed.

When we came out with ASP.NET support, we decided to only make a website template and not a web application template.  However, we did do some basic testing with Web Applications to make sure that our components work correctly and they did.  The reason you don't see the
App_Licenses.dll file in the web application project is because web applications follow the same licensing schema as Windows Forms. In this case, the licenses.licx file gets embedded directly into the assembly that is created.  If you are curious about differences, Microsoft has a document entitled Introduction to Web Application Projects which has a section on the differences between web site projects and web application projects. 

From a web site perspective, we have a topic that talks about licensing in our help entitled Deploying Measurement Studio Web Applications

Hope this clarifies things!

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 4 of 4
(4,206 Views)