We have a C# web application that is being published using a Powershell script. In our C# code we have several places where we check
cmd /c "path\to\msbuild.exe path\to\project.csproj /p:DeployOnBuild=true;PublishProfile=Development /verbosity:minimal"
You need to specify the Configuration Property set to Development
cmd /c "path\to\msbuild.exe path\to\project.csproj /p:Configuration=Development/p:DeployOnBuild=true;PublishProfile=Development /verbosity:minimal"
By default Visual Studio will create the projects with two configurations:
Debug: This one should be used for development, it includes the DEBUG constant by default. Release: This one should be used for production
You can also create custom configurations from scratch or based on Debug/Release, if you based a custom configuration "Development" in Debug, it will include the DEBUG constant, you can remove it manually from the .csproj file or right click the project and review the project properties.
Do not confuse the "Configuration" property with a PublishProfile, the PublishProfile is intended to create a Deployment package after compilation, you can use a PublishProfile combining it with Debug or Release.
If you are using web.config transformations be sure to update the "Release" or the custom configuration transform based on your needs.