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 8527473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:34:01+00:00 2026-06-11T08:34:01+00:00

I have a Windows.Forms client that is packaged as MSI by using a Visual

  • 0

I have a Windows.Forms client that is packaged as MSI by using a Visual Studio Deployment Project.

My app.config has some configuration properties whose values must be replaced by the correct ones depending on the environment I want to deploy the client into.

For instance, my client do connect to a set of COM+ services that are behind a WCF facade, so I have some URLs in the configuration file that vary depending on the environment (development, integration, etc etc).

In such way one can find in the application config line like this:

<add ServiceName="MyService" ServiceEndpoint="$(WS_URL)/MyService.svc" MaxMessageSize="xxxxxx"></add>

Well, the thing is that I need to execute a batch file (.bat) to load some variables and then replace the variables in the app.config, but, I need to do the replacements in the application configuration file that is being packaged in the MSI, and not perform the replacement in the “original” configuration file that is in the client project.

In fact what I would need is just to get the path, of the application configuration file, that VS is about to package, and pass the file-path to my script so that it does the replacements.

NOTE: In the above sample line $(WS_URL) is the variable that must be replaced by its correct value depending on the deployment environment 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-06-11T08:34:03+00:00Added an answer on June 11, 2026 at 8:34 am

    Finally I have the solution that fit our needs. My need was mainly to just have one unique configuration file for the Windows.Forms client and being able to replace some property values in it, just before the file is packaged in the MSI.

    I thought the binaries that are packaged within the MSI were taken from the project(s) output dir., but they are not, so I couldn’t use that location to execute our “variable replacer” script and get the final App.config file ready to be packaged.

    We a have a .bat file, one for each kind of environment configuration, in which we centralize the configuration properties applying for Windows.Forms, Web-Applications, COM+ Serviced Components, so I was disgusted with the idea of replicating the configuration file of the client, because my aim is also to reduce the number of configuration files, to reduce the risk of making a mistake, while keeping the process of creating/maintaining build environments easy.

    I couldn’t find any doc to tell me how could I get the path, of the temporal folder or whatever, where the files are, just before the MSI is being packaged. If I would have access to it, then I would have executed our “variable replacer” script pointing to that directory and problem solved.

    My workaround was to place a customized pre-build event, so that the I copy the “template” App.config to the project directory, and once it is there, I run the script to replace the property values.

    Now, every time the deployment project is built, we are sure it contains a valid configuration file.

    Just FYI, here is how the pre-build event looks like:

    XCOPY /Y $(ProjectDir)config\*.* $(ProjectDir)
    CALL ..\ScriptsCentral\do_apply_config.bat $(ProjectDir)App.config etc
    EXIT 0
    

    NOTE: I had to put the EXIT 0 explicitly because we build all the projects with msbuild and devenv.com and I got the build process stopped in the part where it executes the build event.

    (thanks @ChristopherPainter for your time and comments. +1 for your proposal)

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

Sidebar

Related Questions

Using Visual Studio 2008, c#, .net 2.0. I have a Windows Forms client application
I have a Windows Forms project in Visual Studio that reads configuration files from
I'm using Visual Studio 2008, .net Framework 3.5 for a Windows forms client-server app
I have been working on a project that has 2 interfaces - windows forms
I'm debugging a Windows Forms client that calls a WCF service in Visual Studio
First of all, I am using Visual Studio 10 and coding Windows Forms App.
I have a windows forms client that consumes an ASP.net web service. It's my
I have installed a C# windows forms app on a client machine which does
I've got yet another deployment problem. What I have: little Windows Forms application that
I have implemented a WCF service that exposes operations that a Windows Forms client

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.