More VS2008 to VS2010 Blues

by jmorris 21. October 2010 09:32

I ran into another problem today while updating my VS2008 projects to VS2010. Instead of using the typical Visual Studio Conversion wizard, I wanted to refactor some of my projects into a single project so I created the projects first and then manually copied the files over changing namespaces as I went along. After creating a project for a tool that runs as a console application and moving over the file with the main() method, I got the following exception:

“The referenced assembly ‘D:\XXX.Prism.dll’ could not be resolved because it has a dependency on ‘System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ which is not in the currently targeted framework ‘.NETFramework,Version=v4.0,Profile=Client’. Please remove references to assemblies not in the targeted framework or consider retargeting your project.    XXX.Prism.Damsole”

Whoa, kinda strange…I checked Framework Target on the Properties page and saw that it was:

image

.NET Framework 4 Client Profile? What’s that? A quick google gave me the answer:

“The .NET Framework 4 Client Profile is a subset of the .NET Framework 4 that is optimized for client applications. It provides functionality for most client applications, including Windows Presentation Foundation (WPF), Windows Forms, Windows Communication Foundation (WCF), and ClickOnce features. This enables faster deployment and a smaller install package for applications that target the .NET Framework 4 Client Profile.”

-http://msdn.microsoft.com/en-us/library/cc656912.aspx

image

It turns out that the project I was referencing had a reference to System.Web and since by default VS2010 sets the Target Framework for console applications to the .NET 4 Framework Client Profile, which excludes the following features:

  • ASP.NET
  • Advanced Windows Communication Foundation (WCF) functionality
  • .NET Framework Data Provider for Oracle
  • MSBuild for compiling

Resolution was simple, I just changed the Target Framework to .NET Framework Profile and all was good. It seems kind of strange that MS would default that kind of behavior when it seems to me to be more of an optimization more than anything else and can cause quit a bit of confusion.

Tags: , ,

Visual Studio

Pingbacks and trackbacks (2)+

Jeff Morris

Tag cloud

Month List

Page List