Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Updated steps for setting the NoImpersonate flag for a custom action in Visual Studio 2005

Updated steps for setting the NoImpersonate flag for a custom action in Visual Studio 2005

  • Comments 8

A while back, I posted some instructions that can be used to run a post-build script to modify the custom action attributes of an MSI created by the Visual Studio 2005 setup/deployment project wizard.  This script is particularly useful to set the necessary attributes to make a custom action work correctly with User Account Control (UAC) on Windows Vista (as described in more detail in this blog post).

Since I posted those instructions, a couple of folks have contacted me to let me know that the jscript file provided in that post works correctly when it is run manually, but the steps to run it from within Visual Studio 2005 as a post-build step were failing.

I finally found some time to investigate this issue, and I discovered that I made a typo in the exact name of one of the variables being used in the post-build step.  This was a little tricky to narrow down because my typo was to spell the variable in what should be the correct way - $(BuiltOutputPath).  However, the actual variable name expected by MSBuild and Visual Studio 2005 is $(BuiltOuputPath) with the word spelled "ouput" instead of "output."

At any rate, I have modified the original post I wrote about this topic, and here are updated instructions that can be used to set the NoImpersonate bit in a Visual Studio 2005 setup project as well:

  1. Download the sample script and extract the contents to the directory that contains the Visual Studio project you are working on
  2. Open the project in Visual Studio 2005
  3. Press F4 to display the Properties window
  4. Click on the name of your setup/deployment project in the Solution Explorer
  5. Click on the PostBuildEvent item in the Properties window to cause a button labeled "..." to appear
  6. Click on the "..." button to display the Post-build Event Command Line dialog
  7. Add the following command line in the Post-build event command line text box:
    cscript.exe "$(ProjectDir)CustomAction_NoImpersonate.js" "$(BuiltOuputPath)"
  8. Build your project in Visual Studio 2005

<update date="1/17/2011"> Fixed broken download link to the sample script. </update>

 

  • By Design.

    Ouput = Optimal Unrestricted Path Under Test

    Plus the spec doesn't mention the variable name. (Couldnt resist sticking up for the devs)

  • Hi Samir - Thanks for letting me know about the OUPUT acronym.  I hadn't realized that it stood for something  :-)

  • That error message was highly confusing. Thanks for the script, which appears to works perfectly.

  • I am unable to download the script file. The link seems to be broken. I am having this exact problem. I am in very much need of the script so I can fix my install on Vista machines. Thanks...

  • Hi Steve - My file server is currently down, but if you can contact me via email, I will be happy to send you a copy of this script.  You can contact me by using http://blogs.msdn.com/astebner/contact.aspx or by emailing Aaron.Stebner (at) microsoft (dot) com.

    I'm sorry for the inconvenience.

  • Hi,

    I am not able to find the value of the macro $BuiltOuputPath/$BuiltOupuPath. I am using this variable in windows service (VS 2010, .net framework 3.5) post build event command line.

    Please let me know what am I missing?

    Thanks....

  • Hi Richa - The macro described in this blog post is only valid in setup projects, and it must be spelled $(BuiltOuputPath) with the word "ouput" spelled incorrectly.  Can you please confirm that you're using this macro in the correct type of project and if so, please also confirm that it is spelled exactly the way that it is listed in this blog post?

  • Yes I was taking the macros from windows service project. I have now taken the property of setup projects...and it works fine :)

    Thanks a ton Aaron !!!

Page 1 of 1 (8 items)
Leave a Comment
  • Please add 8 and 7 and type the answer here:
  • Post