Missing Namespace Errors in My .NET Project

Updated May 10, 2023

Reported In

Software

  • Measurement Studio Enterprise
  • Measurement Studio Standard
  • Measurement Studio Professional

Issue Details

When I build my Measurement Studio project in Visual Studio I get an error that states
The type or namespace <namespace name> does not exist in the namespace 'NationalInstruments' (are you missing an assembly reference?)



I have checked my project references and the listed namespaces are included. 

Solution

This error is caused by the project framework configuration as Measurement Studio only supports the full .NET 4.0 (or 3.5) version and not the client profile. To resolve this issue, set the target framework to .NET Framework 4 instead of .NET Framework 4 Client Profile.

For a C# project:
  1. Select View >> Solution Explorer
  2. Right-click on your project and select Properties
  3. In the Project Properties tab, select Application
  4. Select .NET Framework 4 in the Target framework drop-down list.
For a Visual Basic .NET Project:
  1. Select View >> Solution Explorer
  2. Right-click on your project and select Properties
  3. In the Project Properties tab, select Compile
  4. Select Advanced Compile Options
  5. Select .NET Framework 4 in the Target framework drop-down list

Additional Information

One way to avoid this in the future is to use the Measurement Studio project templates because they default to the full .NET Framework, while Visual Studio project templates default to the client profile.