>
Blog
Book
Portfolio
Search

8/12/2008

3864 Views // 0 Comments // Not Rated

Web Setup Projects - Target Framework Issue

I think one of the coolest new features of Visual Studio 2008 is the ability to change the target framework of a project on-the-fly. I personally wouldn't have minded if developers were only allowed to choose their framework when they created a project; the ability to change it afterwards makes upgrades and rollbacks very easy.

However, I noticed an issue regarding changing the target framework of web setup projects. I created a 2.0 .NET solution with Visual Studio 2008 last week, so I had to change all the target frameworks from the default of 3.5 to 2.0 (how depressing to see all the new project types disappear!) since it was going to run on a Windows Server 2003 machine for a client with an indeterminate .NET framework upgrade schedule.

One of these projects was a web service, and another was therefore the setup project for it. Setup projects are sweet as long as the out-of-the-box functionality is enough to plop your code onto a server in all the right places. But once you've got half a dozen custom actions and half the file system mapped, it might be time to write an installer yourself.

Anyways, I made sure to select .NET 2.0 as the target framework for this project as I had for all the others. When I finished, I tried it on my box, and it worked fine. Then after QA, I went to deploy it on the project server, and I was greeted with nasty little message:

Setup Target Framework Error

I frantically went back and checked the target framework of the setup project, thinking that, based on the error message, I was trying to run a 3.5 app on a machine that didn't have the version of the frame work installed. But that wasn't the case; in fact, I couldn't even find the UI to change the target framework (setup projects are different than standard projects)!

However, in my franticness, I didn't realize that the actual error message for not having the specified target framework is much scarier:

Target Framework Not Installed Error

So I dug through all of the options for the cause of this mess, and finally found it here: Right-click web setup project name in Solution Explorer, choose "View" then "Launch Conditions."

In the popup, you'll see one of the default launch conditions is the .NET framework. Right-click this condition, and select "Properties Window." You'll see that even though we made sure to select .NET 2.0 as the target framework for this executable, the .NET launch condition still defaults to require 3.5! In other words, the generated MSI will run on .NET 2.0 and startup just fine; but when it detects that .NET 3.5 is not installed, it will not continue.

So pick 2.0 (or which ever you need) and it should work! Have fun!

3 Tags

No Files

No Thoughts

Your Thoughts?

You need to login with Twitter to share a Thought on this post.


Loading...