views:

416

answers:

3

I have sample code (for deal with scanner in Motorola HC700)

the problem is that i can run this program only on Debug mode

if I try to run on Release mode, I get this error:

The type or namespace name 'Mot' could not be found (are you missing a using directive or an assembly reference?)

thanks in advance

+2  A: 

Things you can to to troubleshoot the problem:

  1. Search you code for #if directives and Conditional attribute. Sometimes they are used to disable part of the code in a DEBUG/RELEASE configurations. This could be the case.
  2. Look for compiler warnings in the error list as well (i.e.: assembly not found and this may break your code later). Some library may be missing from your release build due to the script/build configuration.
Rinat Abdullin
+2  A: 

If you are using a standard csproj, note that files and references can be conditional - i.e. only there in some configurations. You have to go out of your way to do this (the VS IDE doesn't let you do it - only via direct file edit), so it seems unlikely, but it is a possibility.

It is, unfortunately, quite hard to investigate without some concrete examples.

Marc Gravell
A: 

My guess is that "Mot" is contained in a separate DLL than the application and that your Release configuration is either not set to Deploy that assembly when you run or it is set to deploy it to a directory other than where the EXE is getting deployed.

To remedy the first, open the Configuration Manager (it's in the dropdown that says "Any CPU") and check "Deploy" next to the assembly that holds the "Mot" namespace.

To remedy the second, open the Project Properties on both applications, navigate to the "Devices" tab and make sure that the "Output File Folder" matches for each. This is a good idea in any case to prevent Studio from deploying multiple copies of the assemblies.

ctacke