Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Debug/Release Build Configuration with 1 Click Publish dependent on the selected Publish Profile

Tags:

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:

  1. Test Server
  2. 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.

booya

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. :-)

like image 605
David Murdoch Avatar asked Apr 21 '11 01:04

David Murdoch


People also ask

What are debug and release build configurations?

A Debug configuration supports the debugging of an app, and a Release configuration builds a version of the app that can be deployed.

How do I change debug to release in Visual Studio?

On the toolbar, choose either Debug or Release from the Solution Configurations list. From the Build menu, select Configuration Manager, then select Debug or Release.

How do I add a published profile to Visual Studio?

On the computer where you have the ASP.NET project open in Visual Studio, right-click the project in Solution Explorer, and choose Publish. If you have previously configured any publishing profiles, the Publish pane appears. Click New or Create new profile. Select the option to import a profile.


2 Answers

It's possible to do another way by having multiple Web Deployment Packages.

Basically create two different projects and each one will compile and set the asp.net build config and output. Then script the deployment as part of it.

Bit hacky (wish the publish profiles could set the build config as you wished).

Other than that I normally do via powershell scripts and kick off from my desktop deploy that does all the appropriate compiling and deployment scenarios.

http://msdn.microsoft.com/en-us/magazine/cc163448.aspx

http://johnnycoder.com/blog/2010/01/07/deploy-aspnet-web-applications-with-web-deployment-projects/

like image 147
Justin King Avatar answered Oct 24 '22 02:10

Justin King


I was able to get this to work by installing the Visual Studio Web Publish Update. This update allows you to tie a build configuration to a specific publish profile.

http://msdn.microsoft.com/en-us/library/jj161045.aspx

Publish Profile

like image 27
Jeff Avatar answered Oct 24 '22 02:10

Jeff