RE: Windows Installer removes embedded resource manifest ?
- From: Keith Dorken <kadorken@xxxxxxxxxxxxx>
- Date: Tue, 13 Feb 2007 05:27:01 -0800
I found the 'problem'. The built deployment project never got the modified
..EXE file. I will post all the information in hopes it will help others.
My postbuild steps were set up to put the application.exe.manifest file
containing the required Vista <security>...</security> into the .exe found in
$(TargetDir)$(TargetFileName) as follows:
In the Build Events of the project (Post-build event command line):
set DEVENVDIR=$(DevEnvDir)
set PROJECTDIR=$(ProjectDir)
set TARGETNAME=$(TargetName)
set TARGETDIR=$(TargetDir)
set TARGETFILENAME=$(TargetFileName)
set CONFIGURATIONNAME=$(ConfigurationName)
call "$(ProjectDir)PostBuild.cmd"
In the file PostBuild.cmd kept with the Appliction Project:
rem Add the postbuild WIN32 resource identifying the Assembly Security for
Vista
@echo off
set INPUT="%PROJECTDIR%%TARGETNAME%.exe.manifest"
set BINOUTPUT="%TARGETDIR%%TARGETFILENAME%"
pushd %DEVENVDIR%
rem Check for existence of MT.EXE command on system (from .NET 3.0 SDK
assumed to be installed at default location)
pushd ..\..\..\Microsoft SDKs\Windows\v6.0\bin
IF ERRORLEVEL 1 goto NOMT
..\mt.exe -nologo -manifest %INPUT% -outputresource:%BINOUTPUT%;#1
IF ERRORLEVEL 0 goto :EOF
:NOMT
echo %INPUT% manifest resource NOT applied to %BINOUTPUT%
if NOT "%CONFIGURATIONNAME%" == "Release" exit 0
My 'problem' was that the deployment project in the solution was set to use
'Primary output from Application.Project' which is NOT
$(TargetDir)$(TargetFileName);
Deployment projects get their 'input' from
$(TargetDir)..\..\OBJ\$(ConfigurationName)\$(TargetFileName)
I ended up modifying my PostBuild.cmd file with the following steps:
set OBJOUTPUT="%TARGETDIR%..\..\obj\%CONFIGURATIONNAME%\%TARGETFILENAME%"
set BINOUTPUT="%TARGETDIR%%TARGETFILENAME%"
pushd %DEVENVDIR%
rem Check for existence of MT.EXE command on system (from .NET 3.0 SDK
assumed to be installed at default location)
pushd ..\..\..\Microsoft SDKs\Windows\v6.0\bin
IF ERRORLEVEL 1 goto NOMT
..\mt.exe -nologo -manifest %INPUT% -outputresource:%BINOUTPUT%;#1
..\mt.exe -nologo -manifest %INPUT% -outputresource:%OBJOUTPUT%;#1
This ensures both the .EXE under OBJ and the one under BIN get the resource
added to them.
It is not clear why I need to apply the postbuild step to both files; One
would assume doing it to perhaps the OBJ file alone would be sufficient, but
experimentation showed this not to be the case.
Thanks for your other information; I will investigate alternative methods to
embedding the necessary .manifest resource as you suggest. However, if I have
to still build a .RES file separately (from a .RC source file) then embed
that built .RES file into the solution for inclusion, then I have still have
an external dependence on some other project that keeps the .RES file
correct. There appears to be no single step in a managed code project to keep
the .RC source, invoke the resource compiler to build the .RES file, and then
have the .RES file added to the built executable......
There are other resources required to be added besides the RT_MANIFEST (like
the application Icon...)
Also, the Updated Vista Logo Test cases now recommend using CFF Explorer
instead of Resource Hacker to inspect the executables.
"Steven Cheng[MSFT]" wrote:
Hello Keith,.
From your description, you're building a Vista awared application which
will need to embed an manifest file in the win32 resource collection.
However, you found the res manifest occur in the built exe but disappear
after packaged it and deploy onto vista machine, correct?
Based on my experience, windows installer package or the visual studio
setup project won't automatically remove resource from program. In setup
project, you simply add those existing files(exe , dll. ...) into it and it
will copy it and merge into setup package. For your issue, I think there
may has something else cause the manifest not work.
Since you said you have to use the "Post Build" event to inject the win32
resource, are you building a managed application? If so, the Visual Studio
IDE's project properties has provided the built-in support on embed a win32
resource file(.res) into the managed exe program. You find the setting
through the following steps:
** select project node in solution explorer and choose "properties" menu
item
** in the properties setting explorer, choose the first "application" tab
in left view
* in the rigth panel, you can find the "resources" section, by default it
is set as "Icon", you can change it to "Resource File" and manually choose
a win32 res resource file.
Here is a blog article provide detailed description on embed Manifest into
managed code:
#Adding a UAC Manifest to Managed Code
http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx
In addition, for the problem exe program. You can use the Visual Studio
resource editor(or the resource hacker you used) to inspect the exe after
the setup program install it on Vista box.(you can also try installing it
on other OS to see whether the installed exe contains the manifest)
Please feel free to let me know if there is anything I missed or if you
have got any further finding.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- RE: Windows Installer removes embedded resource manifest ?
- From: Steven Cheng[MSFT]
- RE: Windows Installer removes embedded resource manifest ?
- References:
- RE: Windows Installer removes embedded resource manifest ?
- From: Steven Cheng[MSFT]
- RE: Windows Installer removes embedded resource manifest ?
- Prev by Date: RE: Windows Installer removes embedded resource manifest ?
- Next by Date: Re: How to get VS2005 Documentation
- Previous by thread: RE: Windows Installer removes embedded resource manifest ?
- Next by thread: RE: Windows Installer removes embedded resource manifest ?
- Index(es):
Relevant Pages
|