Can you exclude code automatically when using the publish feature in Visual Studio
- by LarryDev
Is their a way to exclude a block of code when you use the publish feature in visual studio. In other words say I had a log in button that did something like:
// Start Exclude when publishing
if (txtUserName.Text == "" && txtPassword.Password == "")
{
lp = new System.ServiceModel.DomainServices.Client.ApplicationServices.LoginParameters("UserName", "Password");
}
else
// Stop Exclude when publishing
{
lp = new System.ServiceModel.DomainServices.Client.ApplicationServices.LoginParameters(txtUserName.Text, txtPassword.Password);
}
This way when I am debugging I can just leave the username and password field blank and just click login and the application will log me on. But when the application is published the compiler woudl ignore that code and not compile it in to the application.