SDK 1.3 Issue: run from VS2010 does not apply config transformation

Answered SDK 1.3 Issue: run from VS2010 does not apply config transformation

  • Friday, December 03, 2010 8:41 AM
     
     

    I have a project with some web.config transformations...

    With Azure SDK 1.2 when I debug from VS2010, creating the package for local "Compute emuletor" the web.config transformation is applied.
    In Azure SDK 1.3, VS2010 seems to apply NO transformations.

    Publishing on azure instead works fine (apply the transformations)

    Thanks

     

All Replies

  • Monday, December 06, 2010 3:37 AM
    Moderator
     
     

    Hi,

    I was unable to reproduce this issue. The steps I tried:

    1.  Create a new cloud service project with one WebRole.
    2. Add the following setting in web.config:
       <appSettings>
          <add key="original_key" value="original_value"/>
        </appSettings>
    3. In Web.Release.config, add:

     <appSettings xdt:Transform="Replace">
        <add key="transformed_key" value="transformed_value"/>
      </appSettings>

       4. Change the configuration to Release for the projects in the solution.

       5. Publish the cloud service project, create service package only.
       6. Unpack the package to check the setting in web.config. It shows the following setting:
    <appSettings>
        <add key="transformed_key" value="transformed_value"/>
      </appSettings>

    Did you try the same steps?

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Windows Azure Platform China Blog: http://blogs.msdn.com/azchina/default.aspx
  • Monday, December 06, 2010 8:59 AM
     
     

    Hi Allen, thanks for your reply.

    Indeed creating a package will apply transformation correctly but running the application from VS2010 will not apply them .

    I think the reason is that
    In SDK 1.2 it works because running the project from VS2010 actually create a package and deploy it in local Development Fabric.
    Otherwise with SDK 1.3 starting the project from VS2010 does not create a package but simpli create a web app in local IIS and in this way all config transformation are not applied.

    I just wondering if there is a way to force config transformations to be applied during debugging within VS2010 or if the only solutions is not to use IIS full mode.

  • Wednesday, December 08, 2010 4:00 AM
    Moderator
     
     Answered

    Hi,

    Your observation is correct. The simplest approach I could suggest is to back up the original web.config and get the transformed web.config by running (you need to change bold ones):

    msbuild PathOfYourWebRole.csproj /t:TransformWebConfig /p:Configuration=Release

     

    Then replace your original Web.config with the transformed one before debugging. Say you run above command you're able to get the transformed web.config from:

    PathOfYourWebRole\obj\Release\TransformWebConfig\transformed

    You may also write/use some Msbuild tasks to do that automatically but it's probably out of the scope of this forum.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Windows Azure Platform China Blog: http://blogs.msdn.com/azchina/default.aspx
    • Proposed As Answer by Anton StaykovMVP Friday, December 10, 2010 9:03 AM
    • Marked As Answer by Fabio Ferrari Friday, December 10, 2010 11:33 AM
    •  
  • Friday, December 10, 2010 7:01 AM
    Moderator
     
     

    Hi Fabio,

    Does my suggestion work for you?


    Allen Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Friday, December 10, 2010 9:07 AM
     
     Answered

    Hi All,

    This is big change in the Tools and now the way we develop Web Roles is moved closer to the way we develop regular ASP.NET Applications. In terms that now we can change markup / css / JavaScripts while the deployment is live in our development environment. And, the transformation issue (if it can be called issue?) is an issue (or feature) within the Visual Web Developer. Even if we are using Visual Web Developer (Visual Studio) to develop regular ASP.NET Applications, while debugging locally the web.config transofmrations are not applied and we are working with the core web.config. But this topic is totally out of scope of this forum.

  • Friday, December 10, 2010 11:36 AM
     
     

    Thanks Allen for your suggestion, it works.

  • Wednesday, December 15, 2010 11:47 PM
     
      Has Code

    Fabio,

     

       You can also add the following property into your cloud service project (.ccproj) file.

    <packagewebrole>true</packagewebrole>

    This will disable the live site capability through.  

     


    Sung Hon