Application identity is not set

Adagio

Well-known member
Joined
Dec 12, 2005
Messages
162
Programming Experience
Beginner
I have some code that should only be run on the published application, not during debug
From what I have been told, the following line should avoid it from stepping into my code during debug mode:

If System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed Then
' Code that is not allowed to be run in debug mode
End if


But if I run this during debug I get this error: "Application identity is not set". But how do I test if this is set or not?
If I have a watch on System.Deployment.Application I just get the message "Application is not a member of Deployment"

Any kind soul in here who knows how to test if Application identity has been set or not and would like to share that information? :)
 
No, that's not what that is for. You should use conditional compilation to include only in a Debug or Release build:
VB.NET:
#If DEBUG Then
        'Any code here will only be compiled in a Debug build.
#Else
        'Any code here will only be compiled in a Release build.
#End If
It's important to realise that this is not a If statement that gets executed at run time. It's an instruction to the compiler. In a Release build the code in the #If block won't even exist, and the same goes for the code in the #Else block in a Debug build.
 
Back
Top