smartpart + CS0234

Feb 18, 2008 at 10: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 ASP.net 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.

Thanks
Aparna
Coordinator
Feb 19, 2008 at 8: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=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

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

Hth,
Jan
Feb 19, 2008 at 3: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.

Regards
Aparna