Alaa Jabre
Alaa Jabre

Reputation: 1903

Control is lost after changing build action to release instead of debug

My problem is: when I set the project build action to release instead of debug a control from an external library is lost. every line that uses it have this error:

'myControlName' is not defined.

the control is part of SDK library (I mean I didn't create it)
when I set the action to debug again and rebuild the problem is gone so what's the problem?

Edit: I have encountered this problem before when i used WeifenLuo DockPanel Suite

now it's another library but the error is the same

Edit: the reference is a dll file
screenshot after setting build action to release. enter image description here

Upvotes: 3

Views: 198

Answers (2)

Hans Passant
Hans Passant

Reputation: 942247

There are project settings that are specific to the configuration, they store different values for Debug vs Release. The very first thing you'll have to fix, visible in the screen shot, is Project + Properties, Compile tab, scroll down, Advanced Compile Options, Target CPU. Change it from AnyCPU to x86. An ActiveX control like you are using is very rarely available in 64-bit mode, you have to force the app to run in 32-bit mode so it can use the control.

That however is a long short for the specific error. Another one that's important and more readily explains such a problem is the Framework Target setting. Try selecting the full one instead of the Client profile. Not a great explanation either btw. Chase possible other fixes by comparing the Compile tab settings for the Debug vs Release configurations. A complete outlier explanation is that you added the ActiveX reference by editing the .vbproj file instead of using the IDE. Be sure to pay attention to any warnings in the Error List window, such a warning may produce hard to diagnose other errors.

Upvotes: 2

lcryder
lcryder

Reputation: 496

How are you referencing the control? Is it in a directory within your solution?

Try right clicking on the source dll within the project, then select 'Properties'. the 'Copy to Output Directory' should be 'Copy Always'.

Upvotes: 0

Related Questions