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

  • SEARCH
  • Home
  • 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 335923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:11:39+00:00 2026-05-12T10:11:39+00:00

I have a Visual Studio setup project. Upon installation, it creates an uninstall batch

  • 0

I have a Visual Studio setup project.
Upon installation, it creates an uninstall batch file in the application folder. IF the user wants to uninstall the product, he can go to “Add/Remove Programs”, or he can just double-click the uninstall.cmd. The contents are:

%windir%\system32\msiexec /x {CC3EB7BF-DD82-48B9-8EC5-1B0B62B6D285}

The GUID there is the ProductCode from the Setup Project in Visual Studio.

ProductCode

But, in order for upgrades to work properly, I have to increment the Version number, every time I produce a new MSI. And, if I increment the Version number, then I also have to generate a new Guid for the ProductCode. Which means the static uninstall.cmd file needs to change.

How can I dynamically generate a batch file that contains the ProductCode for the, at build time?

  • 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-12T10:11:40+00:00Added an answer on May 12, 2026 at 10:11 am

    This is the script I wrote that creates an uninstall.cmd. It runs as a custom action during installation.

    var fso, ts;
    var ForWriting= 2;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    
    var parameters = Session.Property("CustomActionData").split("|"); 
    var targetDir = parameters[0];
    var productCode = parameters[1];
    
    ts = fso.OpenTextFile(targetDir + "uninstall.cmd", ForWriting, true);
    
    ts.WriteLine("@echo off");
    ts.WriteLine("goto START");
    ts.WriteLine("=======================================================");
    ts.WriteBlankLines(1);
    ts.WriteLine(" Uninstall.cmd");
    ts.WriteBlankLines(1);
    ts.WriteLine("=======================================================");
    ts.WriteBlankLines(1);
    ts.WriteLine(":START");
    ts.WriteLine("@REM The uuid is the 'ProductCode' in the Visual Studio setup project");
    ts.WriteLine("%windir%\\system32\\msiexec /x " + productCode);
    ts.WriteBlankLines(1);
    ts.Close();
    

    The result is a cmd file that always has the current ProductCode in it.

    The downside of this is that ?the script that creates the uninstall.cmd remains in the installation directory. Not a huge problem but I don’t like the rubbish in the install directory. I haven’t yet tried to make the “createInstaller.js” self-deleting. That might work.

    EDIT: yes, making the createInstaller.js self-deleting works fine.

    I’m going to accept my own answer!

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

Sidebar

Ask A Question

Stats

  • Questions 188k
  • Answers 188k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Thanks to all the above attempts, and all that contributed,… May 12, 2026 at 5:40 pm
  • Editorial Team
    Editorial Team added an answer As far as I understand you want to make sure… May 12, 2026 at 5:40 pm
  • Editorial Team
    Editorial Team added an answer Assuming your tables are structured where each table has a… May 12, 2026 at 5:40 pm

Related Questions

I've had someone else's pile of stuff handed to me. Among these items is
I'm working with a small (4 person) development team on a C# project. I've
(Was: ASP.Net codebehind not finding controls on the web page) I'm using VS 2008.
I have a Visual Studio Setup Project that I use to install a fairly

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.