smartpart + CS0234

Feb 18, 2008 at 9:55 PM
Hi All,

I am using ReturnOfSmartPart in my project.
I am getting the following error when i try to upload the .ascx file on the smartpart.

Error: unable to load ~\/UserControls\EditMyProfile.ascx

Details: error CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

I am using 2.0 & C# for developing the .ascx & .cs files.

The reference to the Microsoft.Office.Server.UserProfile is also added, and the assembly is deployed in the GAC.
But still for some unknown reason, i am getting the error.

Please help.

Feb 19, 2008 at 7:50 AM
Hi Aparna,

You need to add the reference to the Microsoft.Office.Server.UserProfile in the user control file (ascx) manually. Just open the ascx file in Visual Studio, and switch to the source view so you see the html tags etc. As the first line add:
<%@ Assembly Name="Microsoft.Office.Server, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Alternatively: you can add the Microsoft.Office.Server.UserProfile in the assemblies section of the web.config.

Feb 19, 2008 at 2:26 PM
Hi Jan,

The code is working perfectly.

I am new to working on MOSS2007 and I really like the concept of smartparts as it gives a lot of flexibility to the developers for web parts.

Thank you very much for such prompt response.

Thanks once again.