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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:09:28+00:00 2026-06-05T12:09:28+00:00

In legacy Visual Studio Deployment Project installers, passing a command-line parameter that specified a

  • 0

In legacy Visual Studio Deployment Project installers, passing a command-line parameter that specified a value for TARGETDIR allowed me to override the default installation location (most of my installations take place without user interaction, so command-line automation is used heavily). However, the impression I’m getting is that WiX (by default) uses TARGETDIR for something different. While I can (and will) update our command-line tools to change the parameter name, that still leaves all of our existing installations that would need to be touched manually (a non-trivial effort).

Is there any way to override the installation location in a WiX package by specifying TARGETDIR without breaking anything?

  • 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-05T12:09:29+00:00Added an answer on June 5, 2026 at 12:09 pm

    After doing more digging, it looks like my previous experience is a result of behavior specific to VSDPROJ’s (and possibly InstallShield), wheras WiX is conforming to the Windows Installer.

    As I discovered at this link, TARGETDIR is actually supposed to represent the root of the drive with the most free space available (assuming there’s more than one). That’s why WiX projects have directories nested under there for Program Files, etc. Visual Studio actually adds a custom action that overrides this property to the full installation path.

    I was able to accomplish what I wanted by doing two things:

    1. Change all of my components and component groups to install to TARGETDIR instead of INSTALLFOLDER (the default directory that WiX put in there)
    2. Add a custom action that sets the value of the TARGETDIR property to the installation path, assuming one wasn’t passed in from the command line.

    To do that, I added this under the <Product> tag:

    <CustomAction Id="SetTARGETDIR" Property="TARGETDIR" 
                  Value="[ProgramFilesFolder][Manufacturer]\[ProductName]" 
                  Execute="firstSequence" />
    

    And this within the <InstallExecuteSequence> tag:

    <Custom Action="SetTARGETDIR" Before="CostFinalize">TARGETDIR=""</Custom>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a legacy project where they had a bunch of visual studio setup
I have a Visual Studio 2008 project with some legacy native C++ DLL projects,
I have a Visual Studio 2010 Deployment Project with the following settings: DetectNewerInstalledVersion =
I have a large legacy C++ project compiled under Visual Studio 2008. I know
I have a legacy (haha) ASP.Net Webforms Web Site Project in Visual Studio 2008
I have legacy C# code and I am using Visual Studio 2008. I am
I have an legacy installation from a DotNet 1.1 application (with Visual Studio 2003)
I'm using Visual Basic 6 for a legacy project and it's been working fine.
I have a web site that built on Visual studio 2008 and i need
We have a legacy c++ .dll compiled for windows under visual studio. We have

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.