Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4055642
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:43:36+00:00 2026-05-20T14:43:36+00:00

Is it possible to include variables in a web.config transform file? For each environment,

  • 0

Is it possible to include variables in a web.config transform file? For each environment, I have basically the same transform, just with different values. For example, for the development environment, I’d have…

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <appSettings>
        <add key="serverName" value="server1" xdt:Transform="Replace" xdt:Locator="Match(key)" />
        <add key="serverPath" value="\\server1" xdt:Transform="Replace" xdt:Locator="Match(key)" />
    </appSettings>
</configuration>

And for the QA environment, I’d have…

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <appSettings>
        <add key="serverName" value="server2" xdt:Transform="Replace" xdt:Locator="Match(key)" />
        <add key="serverPath" value="\\server2" xdt:Transform="Replace" xdt:Locator="Match(key)" />
    </appSettings>
</configuration>

The only difference is the value for server1 vs server2. This is a simple example, and in reality, I use the server value multiple times in the transform. Is there any way to declare a variable in the transform file to be used multiple times? Something like…

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <property name="server" value="server2" />
    <appSettings>
        <add key="serverName" value="${server}" xdt:Transform="Replace" xdt:Locator="Match(key)" />
        <add key="serverPath" value="\\${server}" xdt:Transform="Replace" xdt:Locator="Match(key)" />
    </appSettings>
</configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:43:37+00:00Added an answer on May 20, 2026 at 2:43 pm

    I did something similar to this a few months ago. Example is at http://www.geoffhudik.com/tech/2010/10/19/webconfig-automation-with-t4-and-a-macro.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to include one CSS file in another?
I was wondering if it is possible to include inner variables or delegates in
Is it easy/possible to do a simple include('./path/to/file') type of command in node.js? All
is it possible to include a servlet in a jsp page? if so how?
Is it possible to split large ASP.NET-pages into pieces? JSP has the jsp:include directive.
Is it possible to specify a Java classpath that includes a JAR file contained
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Is it possible to pass a variable to a linked .js file? I tried
I would like to know how is possible to read a file placed in
I'm trying to include JavaScript variables into PHP code as PHP variables, but I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.