Visual Studio 2012 Web Deploy Publish ignores selected Configuration for transform and build
Asked Answered
V

3

10

When I create a publish profile I have the option to select which Configuration I want the publish to use for this profile. The options are like Debug, Release or any custom defined one like Staging. The problem is that if I select any Configuration other than Release or Debug, say Staging, visual studio totally ignores my selection and uses Web.Release.config for transform and build. Am I doing something wrong or is this by design? It seems that Publish only recognizes Release and Debug as acceptable Configuration. Any thoughts on this issue?

I am using Visual Studio 2012 RTM.

Update 1 :: "NightlyLive - Any CPU" configuration selected:

Here I select my own custom Configuration "NightlyLive":

enter image description here

And here is what happens when I publish:

6>------ Build started: Project: UI.Next, Configuration: Release Any CPU ------
7>------ Publish started: Project: UI.Next, Configuration: Release Any CPU ------
7>Transformed Web.config using [...]\UI.Next\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.

As you can see it builds the project using Release Any CPU (instead of NightlyLive - Any CPU) and also it transforms the Web.config using Web.Release.config (instead of Web.NightlyLive.config).

Update 2 :: Profile name renamed to "NightlyLive":

Here i rename the profile name from "test" to "NightlyLive".

enter image description here

Here is the console output:

6>------ Build started: Project: UI.Next, Configuration: Release Any CPU ------
7>------ Publish started: Project: UI.Next, Configuration: Release Any CPU ------
7>Transformed Web.config using [...]\UI.Next\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
7>[...]\UI.Next\Web.NightlyLive.config(23,18): Warning : Argument 'debug' did not match any attributes
7>[...]\UI.Next\obj\Release\TransformWebConfig\transformed\Web.config(78,6): Warning : No attributes found to remove
7>Transformed obj\Release\TransformWebConfig\transformed\Web.config using [...]\UI.Next\\Web.NightlyLive.config into obj\Release\ProfileTransformWebConfig\transformed\Web.config.

So here, still it is building using Release Any CPU.

But for Web.config it first transforms using Web.Release.config then it does a second transformation on top of the previous one using Web.NightlyLive.config.

The double transformation i think is by design and makes sense. But the fact that you have to rename your profile name to the configuration name to force use your custom transformation file, does not look right.

Update 3 :: TestSolution added

You can download the stripped down solution from here.

First I created a brand new vs2012 solution and everything worked fine. So I decided to strip down my current solution and upload as test case.

Please note that my solution was originally a vs2010 solution that i opened in vs2012 and vs2012 did the necessary modifications to the solution.

Update 4 :: Verdict

I guess my solution configurations were all messed up. So basically to solve this issue, I deleted all my customized solution and project configurations and created them again along with the web.config transform files.

Problem solved.

Vocalism answered 17/8, 2012 at 19:16 Comment(0)
A
13

I experienced exactly the same behavior.

The issue for me was that the custom solution configuration didn't properly reference the custom configuration in the web project I was trying to deploy.

Try the following:

  1. Right click the Solution and enter properties
  2. Select your custom configuration from the top left dropdown
  3. Expand Configuration Properties and select Configuration
  4. Make sure that you web project has the correct custom configuration selected in the table.

After doing this the web deploy with custom configuration worked properly.

Adage answered 23/5, 2013 at 18:38 Comment(2)
Thanks for sharing your answer but that wasn't the case in my VS Solution. I think conversion from VS 2010 -> VS 2012 wasn't quite successful for my solution and messed things up :>Vocalism
+1 This is sneaky. I had the build config set proper on the toolbar, the project properties view had the proper config as well. However, when I went into the Solution properties and expanded the config one of the project had a different config selected. Many thanks, this worked for me.Slither
A
3

I also did a conversion of a VS2010 solution into VS2012 and was having the same problem. With the help of some of these answers to give me clues to focus on, I was able to pinpoint the culprit to a combination of my publisher profile and Configuration Manager.

In my Configuration Manager, I had three "active solution platforms" for my staging configuration: Any CPU, Mixed Platforms, and x86. The default view for my staging Config Manager was Mixed Platform which was all set to the staging configuration. When I went to create my publisher profile, I had selected "Staging - Any CPU" which unknowingly to me initially, was using the release configuration. Once I started changing platforms in the configuration manager, the issue was apparent and I was able to properly set the configuration for every configuration/platform combination in the solution.

So to make a long story short, make sure you check each active solution platform (change via dropdown) in the configuration you want to publish in and verify that each project is using the correct config in the Configuration Manager. In addition, ensure that your publisher profile is using the correct configuration/platform combination.

Agateware answered 27/8, 2013 at 19:9 Comment(0)
S
2

On the web publish dialog we now let you specify the build configuration on the Settings tab. It defaults to Release.

enter image description here

In your case can you make sure that you have Staging selected there. FYI if you do not see Staging as a menu option then its because you created a Solution Build Configuration but not a Project Configuration. The drop down is driven off of Project Build Configuration values and not Solution Build Configurations. You can edit Solution/Project Build configurations using the Configuration Manager.

enter image description here

Slake answered 19/8, 2012 at 19:1 Comment(7)
tnx Sayed. I do select my configuration from the drop down. but the build and web.config transform are executed using Release configuration. please look at the updated information i added to my post.Vocalism
btw, the only way i can force my publish profile to use my customized configuration (like NightlyLive) is to rename the publish profile name to exactly the same name as my configuration (which is NightlyLive.)Vocalism
You shouldn't have to name them the same. Can you upload a sample project to skydrive/dropbox and share the link here so that I can take a look?Slake
Sayed, please take a look at my Update 3. I think my solution is messed up. I think I have to delete all my custom configurations and recreate them to fix the problem :>Vocalism
@Sayed Ibrahim Hashimi I have the same behaviour as in Update 2. Did you ever get to the solution for this (apart from use the solution suggested in Update 3). My solution is an older VS 2010 now managed with VS 2012.Circumspect
@SayedIbrahimHashimi I had the same problem and the only solution was to rename my profile to the same name as the configuration. This was also a VS2010 project that was updated to 2012. It sounds like there is a bug lurking somewhere.Munger
Same problem here. I can't remember if the project was natively created in VS2012, or migrated from VS2010. I could not have it working until I renamed the profile exactly as the project configuration, now it picks the right transform.Fortyish

© 2022 - 2024 — McMap. All rights reserved.