Share o=(^.^)=o Point

This site documents a noob's discovery journey on sharepoint portal server 2003. Replace all square brackets ([) with triangle brackets (those used in webscripts).

Tuesday, September 27, 2005

The type or namespace name 'SharePoint' does not exist in the class or namespace 'Microsoft'.

Situation: You try to write a script outside sharepoint and you get a compilation error when you try to import a microsoft library.

Log from parser:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'SharePoint' does not exist in the class or namespace 'Microsoft' (are you missing an assembly reference?)

Source Error:

Line 3: [%@ Import Namespace="System.Data.SqlClient" %]
Line 4: [%@ Import Namespace="System.Web" %]
Line 5: [%@ Import Namespace="Microsoft.SharePoint" %]
Line 6: [%@ Import Namespace="Microsoft.SharePoint.WebControls" %]

Cause: Programs are dumb, they don't know where to look for DLL files.

Solution: Create a bin folder in your sharepoint directory, for example c:\inetpub\wwwroot\bin or c:\inetpub\wwwroot\mysharepointdir\bin, then go to c:\windows\assembly, copy Microsoft.Sharepoint.dll, pasted in the bin folder. In your script, add the line: [%@ Assembly Name="Microsoft.Sharepoint" %] in between line 4 and 5.

Change square brackets to triangle brackets.

2 Comments:

At 8:01 PM, Blogger little toy brush said...

sorry, the lines appeared blank because i left the code in its original form. it's now in place after i changed the triangle brackets to square brackets. you will need to change it back.

 
At 3:20 AM, Blogger LD2 said...

thanks for the tip! It worked out great..

 

Post a Comment

<< Home