Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS
with no warranties, and confer no rights. Additionally, views expressed
herein are my own and not those of my employer, Microsoft.
I ran across a mail thread today describing some problems that folks have run into while trying to use the setup and deployment project types in Visual Studio 2005 on post-beta 2 builds of Windows Vista. I want to describe the symptoms and how to workaround this issue in case you run to this in your development scenarios.
What are the issues?
When trying to create a new setup project in Visual Studio 2005 on post-beta 2 builds of Windows Vista, an error dialog appears stating "The Operation could not be completed. The parameter is incorrect." The error dialog looks like this:
When trying to open an existing setup project in Visual Studio 2005 on post-beta 2 builds of Windows Vista, an error dialog appears stating "One or more projects in the solution could not be loaded for the following reason(s): The application for the project is not installed. These projects will be labeled as unavailable in Solution Explorer. Expand the project node to show the reason the project could not be loaded." The error dialog looks like this:
How can I fix these issues?
The underlying issue will be fixed in Visual Studio 2005 service pack 1. Until then, you can workaround this issue by using the following steps:
This workaround will prevent you from including the Visual J# redistributable package in your project using the bootstrapper, but it will allow you to use the rest of the setup/deployment project infrastructure in Visual Studio 2005.
What is the root cause?
I didn't find detailed information about the root cause of this problem, but the information I found stated that the underlying cause is within Visual Studio 2005 and not Windows Vista. Some Windows APIs that Visual Studio 2005 calls were being used in ways that were not officially documented or supported, and this behavior has been changed in Windows Vista. This is one of the dangers of relying on undocumented API behaviors in an application.
One additional note here - if you found this blog post and are using the Visual Studio 2005 setup/deployment projects, I highly encourage you to check out WiX if you haven't already. The following references are very useful for getting started with WiX:
I installed Windows Vista RC2 a couple of weeks ago and started working on some of the remaining issues
Question: I have seen some of your previous blog posts (such as this and this ) regarding compatibility
Details about the .NET Framework 2.0 setup packaging Available command line switches for .NET Framework
Thank you very much...
This saved me from re-installing vs 2005
I have created a setup project in visual studio on windows XP and while deploying it on Vista the installation succeeds. But when I click the program shortcut vista tries to install and configure the application, this part I don't understand. And then it throws an error saying that a program/component required for the installation to complete couldn't be run and it exits.
I have searched on google but no one seems to have encountered this problem, or maybe i'm using the wrong search terms.
Hi Adityayadav76 - The Visual Studio setup projects create what are called "advertised shortcuts" in the MSIs that they build. These are explained in a bit more detail in the MSDN article at http://msdn2.microsoft.com/en-us/library/aa371847.aspx. The key statement that sounds relevant in your case is this:
When the shortcut is activated, the installer verifies that all the components in the feature are installed before launching this file.
In your case, it sounds like this verification is failing, and as a result Windows Installer is triggering a repair of your MSI.
You can take a look at the application event log on your system for events that come from the MsiInstaller source to narrow down what component in your MSI is triggering the repair. It should list the component ID for the component that it thinks is broken, and you can use that to look in your MSI in an MSI editor like Orca to try to narrow down why it is broken in your scenario.
Hopefully this helps.
I often receive emails and blog comments from customers who are having trouble installing the .NET Framework
I figured out what was the problem. I had lost your blog url as my computer got reformatted taking the Bookmark with it. Just found it today.
For the readers. Let me restate the problem and the solution.
I had created a setup project. And I was putting one pre-requisite software in the windows temp directory and running it as a custom action as the part of the installation.
After the installation when I used to click on the shortcut to run the application. Since it was an advertised shortcut it was trying to verify the components. The pre-requisite used to be missing in the windows temp folder and it used to give errors. Though if I went to the program folder using windows explorer and ran the program directly it used to run without any problems.
For the time being I'm putting pre-requisites in the application folder. Installing it by running it as a custom action and leaving it there.
The other option for me was to use Orca and set a parameter to not use Advertised Shortcuts during installation. Which would have involved me to patch the MSI file after creation of the setup files. Since there was no automated way that I could find to do that. I didn't choose this option.
Hi Adityayadav76 - I'm glad you were able to figure out this scenario.
One thing - there is a possible way to automate creating non-advertised shortcuts for a Visual Studio setup project. Starting in VS 2005, setup projects have a post-build task that you can use to run additional steps after the MSI is created. You could create a script that uses Windows Installer APIs to modify your MSI directly to configure it in ways not supported in the UI for the setup project.
There are a couple of examples that I've previously posted of similar scripts that you can use as examples if you'd like: