Visual Studio 2010 Winform Application – Unable to resolve custom assemblies?

Posted by Harish Ranganathan on Geeks with Blogs See other posts from Geeks with Blogs or by Harish Ranganathan
Published on Tue, 25 May 2010 09:39:40 GMT Indexed on 2010/05/25 11:02 UTC
Read the original article Hit count: 479

Filed under:

Recently I surfaced a problem where, one of my friend had a tough time in getting rid of an assembly reference error.  Despite adding reference to the assembly, while referencing it in code, it was spitting out the “The type or namespace name ‘ASSEMBLYNAME’ could not be found” error.   This was a migration project and owing to the above error, it was throwing another 100 errors.

We tried adding reference to the assembly in other projects and it was not even resolving the namespace while typing out in the using section.

Upon further digging into the error warnings, it indicated something to do with the .NET Framework targeted i.e. 4.0.  My suspicion grew since the target framework was 4.0 and the assembly should be able to be recognized. 

Then, when we checked “Project – “<APPNAME> Properties…”, the issue was with the default target framework which is “.NET Framework 4 Client Profile”

image

By default, Visual Studio 2010 creates Windows Forms App/WPF Apps with the Target Framework set to .NET Framework 4 Client Profile.  This is to minimize the framework size required to be bundled along with the app. Client Profile is new feature since .NET 3.5 SP1 that allows users to package a minified version of .NET Framework that doesn’t include stuff such as ASP.NET, Server programming assemblies and few other assemblies which are typically never used in the Desktop Applications.

Since the .NET Framework client profile is a minified version, it doesn’t contain all the assemblies related to Web services and other deprecated assemblies.  However, this application is a migration app and needed some of the references from Services and hence couldn’t run.

Once, we changed the Target Framework to .NET Framework 4 instead of the default client profile, the application compiled.

Here is link to a very nice article that explains the features of .NET Framework 4 client Profile, the assemblies supported by default etc., http://blogs.msdn.com/b/jgoldb/archive/2010/04/12/what-s-new-in-net-framework-4-client-profile-rtm.aspx

Cheers !!

© Geeks with Blogs or respective owner