Daddysauce Forums
September 04, 2010, 10:24:27 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
Go back to Daddysauce.Com Homepage
News: Tell me what you think about T-shirt slogans for the site!  Topic is located under "Daddysauce Products"
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: NoImpersonate flag in VS2005  (Read 916 times)
daddysauce
Administrator
Full Member
*****
Posts: 165



View Profile WWW
« on: January 04, 2007, 09:18:40 AM »

How to set the NoImpersonate flag for a custom action in Visual Studio 2005

Problem:
I have built an installer using the Visual Studio 2005 setup project wizard.  It installs correctly on Windows XP but fails on Windows Vista.  I investigated and found that the failure on Windows Vista is caused by a custom action that fails with an access denied error.  However, I am running the setup with elevated privileges in Windows Vista.  How can I fix my setup so it will work correctly on Windows Vista?

Answer:
As Robert Flaming described in this blog post, it is necessary to set the NoImpersonate flag for custom actions that modify the system in Windows Vista.  This was an uninforced architectural intent that is now enforced in Windows Vista.

Unfortunately, there is not a way to directly set this flag for a custom action in the UI for the setup project in the Visual Studio IDE.  In Visual Studio 2005, you can use a post-build step that modifies the MSI to set this bit using a strategy previously described in this blog post.

You can use the following steps to set the NoImpersonate bit in a Visual Studio 2005 setup project:

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

Source:   http://softlogger.com/5520/ASP-NET/mailbag-how-to-set-the-noimpersonate-flag-for-a-custom-action-in-visual-studio-2005.aspx
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!