Tuesday, November 03, 2009
« Microsoft Distributed Cache (Velocity) A... | Main |

Tonight while building some windows services with Visual Studio 2010 Beta 2 I ran into an interesting issue. I went through the normal steps of adding a project to my solution like I always do making sure that .NET 4 was chosen as the target framework. I then added my project references which are a couple of shared assemblies that I use for a number of different projects. Though all of them were also written with the .NET 4 framework as the target. After all this I did a compile to make sure that we were all good and strangely things were not all good. I had no code in my service at this time. I had only added my references. So I checked the error list and I saw the following error:

The referenced assembly "C:\Users\Admin\Documents\Visual Studio 2010\Projects\xxxxxx\xxxxxx.Utilities\bin\Debug\xxxxxx.Utilities.dll" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".

Now upon intially reading this I thought "oh that's simple I just need to add a reference to "System.Web" to my project and everything will be fine. So I proceeded to attempt to do this and I did not see System.Web. Though if I went in other projects I saw it just fine. So now I was really scratching my head. So I tried to do some searches online and did not come up with anything except one site listing this as a broken change but with no resolution. So I dug around more in my project and finally discovered the answer. Which was there all along but since I wasn't familiar with it I did not pick up on it, Profile=Client. It turns out that when adding a new Windows Service with .NET 4 as the target framework it will automatically choose the ClientProfile for the target. Which if you aren't familiar you can read about here: http://blogs.windowsclient.net/trickster92/archive/2008/05/21/introducing-the-net-framework-client-profile.aspx

So I changed this back to .NET 4 as the target framework and everything was working as expected. So if you see this error at least you now have a heads up on where to check. Also a good reminder to check which target framework was selected when adding new projects.

Tuesday, November 03, 2009 7:37:07 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Related posts:
Microsoft Velocity CTP3 and Windows 7 Installation Error
Keep Tabs in Visual Studio 2005

Comments are closed.