This is almost a duplicate of Link build configuration to a publish profile, but that question was not answered...
I have 2 1 Click Publish configurations for my Web Application:
- Test Server
- Production Server
If I select Build
=> Configuration Manager
=> Release
and then click the Publish button my application will be published with a release configuration (and visa versa) - without regard to the current Publish profile selected.
But what I REALLY want is...
To set the appropriate Build Configuration from the 1 Click Publish settings. Test Server
should be published with my Debug settings and Production Server
should be published with the Release settings.
I shouldn't have to make the change from within the Configuration Manager. But I Do.
So, I have 2 questions:
Am I just doing it wrong? Based on a little note in the Publish Settings stating "Use Build Configuration Manager to change configuration" this seems like this is exactly how it is intended to work.
Is there another way of having 2 publish profiles, one with a Debug config and one with a Release config?
The only thing I'm using the debug/release build configurations for is for my Config Transforms that have different connection strings. So, alternative, but still 1 Click, publishing solutions are acceptable. :-)
Environment.MachineName.Equals("MyLiveServersName")
and choose my ConnectionString based on that. For now, mine is just hard-coded into the application itself but you could (and probably should) go as far as to set your live servers' name(s) in your web/app.config via a ConfigurationSection or appSettings. – Risk