Problem removing files from "C:\WINDOWS\WinSxS\Manifests" - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi,

I have just downloaded the trial version of Advanced Installer, version 6.4.1. It looks really good and it appears to work as expected in most areas.

But there is one little thing I do not understand, if anybody can give me a hand with this I would appreciate it.

My application contains some files in “C:\Program Files\<Application>”. These files are in the Advanced Installer project and this works fine. After removing the MSI from the target computer, this folder is removed as expected, so far so good.

We are also installing some files in “C:\Windows\WinSxS\Manifests”, but after the removal of the MSI these files are not removed by the MSI created by Advanced Installer. It does not give me an error message; it just leaves the files there. Despite the fact that these files are not removed, I would still be happy with Advanced Installer.

The trouble starts when I try to re-install the MSI. I would expect it overwrites the files in “C:\Windows\WinSxS\Manifests”, but it does not. It gives me the error message “The Windows Installer service cannot update the system file “C:\WINDOWS\WinSxS\Manifests\<filename>’ because the file is protected by Windows. You may need to update your operating system for this program to work correctly.”

I would say the solution is to remove the files during uninstall, so I tried a Custom Action with a vbs script, which worked. But the problem with this workaround is that the filenames of the files to remove are hard coded in the script. If the user installs Windows in an alternative folder the script cannot find the files to remove.

Another thing I tried is to check the option “Ensure that this file overwrites any installed target file.” In the Version tab, unfortunately this workaround was unsuccessful.

As said before, any help is greatly appreciated.

Warm regards,

Jan
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hello Jan,

I am not sure doing anything in the Windows Installation folder is the right thing to do for any application these days, esp. when it comes to Windows Vista, but be that as it may.

You can access environment variables and Windows Installer properties in a custom action script, maybe that can do the trick for you:

Session.Property Property

(You can get a list environment variables by entering "set" into cmd.exe.)



Also it might be possible to put the files/folders into the installer as temporary files, and copy them in a script only when necessary. (The FileSystemObject is of great help when dealing with files and folders.)



With best regards

Clemens Anhuth
janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi Clemens,

Thanks for replying to my question. I totally agree with you, that we should not do anything under the Windows installation folder. Unfortunately our application is a Visual Studio 2008 application leaving files in the folder.

Currently I have this little script is my Custom Action:

Set fso = CreateObject("Scripting.FileSystemObject")
Set aFile = fso.GetFile("[#msvcm90.dll]")
aFile.Delete

I know how to set an environment variable in Advanced Installer, but I have no idea how to address it from my script.

Regards,

Jan
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi,

Are these files assemblies? If so, note that you can use the Assemblies page to install them.

Please generate a log of the uninstall by running this command line after the MSI is installed on a clean machine:

Code: Select all

msiexec /x GUID /L*V "C:\package.log"
where "GUID" is the Product Code of the package. If the problem persists, please send us the log and the AIP (Advanced Installer Project file) to support at advancedinstaller dot com so we can investigate them.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hello Jan.
janalphenaar wrote:I totally agree with you, that we should not do anything under the Windows installation folder. Unfortunately our application is a Visual Studio 2008 application leaving files in the folder.
Which files does it leave behind in there? If this is about stuff like CRT, MFC, etc. you could ship those along with your application the exact same way AI does for itself (no installation of these additional libs is required).


janalphenaar wrote:I know how to set an environment variable in Advanced Installer, but I have no idea how to address it from my script.
One of the links I posted contains information about the "Session" object available in custom action scripts. You can get and set properties with it, like var theAPPDIR = Session.Property("APPDIR");. It can also be used to access environment variables (which on Windows contain the path to the Windows installation).



With best regards

Clemens Anhuth
janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi everybody,

I was successful in removing my folder “C:\WINDOWS\WinSxS\<foldername>” with the following vbs script in my Custom Action:

set FSO=CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject( "WScript.Shell" )
JansVar = oShell.ExpandEnvironmentStrings("%windir%/WinSxS/<foldername>")
FSO.DeleteFolder(JansVar)

For files I use an equivalent of this.

What still wonders me is why these files are not automatically removed by Advanced Installer. Could this be a future feature ? During my debugging I figured out that Advanced Installer is not automatically removing files from the folder “C:\WINDOWS\WinSxS”.

Many thanks to everybody who helped resolving this issue.

Regards,

Jan
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi Jan,
What still wonders me is why these files are not automatically removed by Advanced Installer. Could this be a future feature ?
Please note that the install and uninstall processes are handled by Windows Installer. You have answered to my question about your files, can you please specify if you are installing assemblies? Also, I'm not sure why you encountered this behavior. Can you please send us a log of the installation which shows this problem so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi Cosmin,

Ok, I have created an example MSI which reproduces this problem. The only thing this MSI does, is installing a file testfile.txt in the folder “C:\windows\WinSxS”

After removal of the MSI, this file stays on the computer.

I will send the example.msi and output.log file to support at advancedinstaller dot com.

Regards,

Jan
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi Jan,

Windows Installer cannot remove the files installed in the WinSxS folder because they are under System File Protection. Although it is not recommended, the custom action you are using is the only solution. The best approach would be to make sure that your application doesn't write files in this folder.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
canhuth
Posts: 241
Joined: Thu Jun 19, 2008 9:03 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hello Jan,

if you can provide details on the files installed in WinSxS maybe it is possible to find a way to not install them there in the first place.


With best regards

Clemens Anhuth
janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi everybody,

My solution as described above is working for Win2k and WinXP. Files are happily installed in C:\WINDOWS\WinSxS and C:\WINDOWS\WinSxS\Manifests. During uninstall they are also successfully removed with a Custom Action.

But when I installed the MSI on Windows Vista, Advanced Installer gave me an error message that I do not have enough privileges to install files in these directories. Back to the drawing board again….

Anyway I figured out that my files should actually be installed with a Merge Module (Visual C++ 9.0 CRT(X86) WinSXS MSM). And this works on WinXP, the libraries are installed in the directory

C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375

With this the application is working correctly.

But on Windows Vista the libraries are not installed, looks like this merge module is not installed at all. Resulting in the fact that our application is not working. Welcome back in Microsoft’s “dll hell” :evil: .

Is this a bug in Advanced Installer, or am I missing something ?

Any help is greatly appreciated.

Warm regards,

Jan
janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi everybody,

After installing the MSI, the folder is not visible under the WinSxS directory, but after rebooting the machine it is (on Vista). But it is not entirely correct, since it is installed under:

C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91

In stead of:

C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375

Resulting in the fact that our application is not working from the MSI.

Warm regards,

Jan
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi Jan,
But when I installed the MSI on Windows Vista, Advanced Installer gave me an error message that I do not have enough privileges to install files in these directories.
Please note that this message is shown by Windows Installer, not by Advanced Installer. Also, the correct approach is to use the Microsoft merge modules like you found out.
After installing the MSI, the folder is not visible under the WinSxS directory, but after rebooting the machine it is (on Vista). But it is not entirely correct, since it is installed under:
C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91
In stead of:
C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
Please note that both folders you specified are included in the merge module you are using. However, the folder

Code: Select all

C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91
is used on Vista and Windows Server 2008 and the folder

Code: Select all

C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
is used on systems with an OS earlier than Vista.

Therefore, the merge module is installed correctly. In this case, perhaps your application is causing the problem. Is your application aware of the folder change on Vista?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
janalphenaar
Posts: 18
Joined: Thu Jul 31, 2008 8:47 am

Re: Problem removing files from "C:\WINDOWS\WinSxS\Manifests"

Hi Cosmin,

Thanks a lot for your help in resolving this issue. I will have a look at the code in the program; see if there is something not behaving correctly.

Once it is resolved, I will post a message here.

Warm regards,

Jan

Return to “Common Problems”