Monday, January 19, 2009

The type or namespace name 'Office' does not exist in the namespace 'Microsoft'

Scenario:
I was on a WSS machine ( not MOSS ) and was trying to demonstrate a basic workflow. But when I tried building the project. I got this:

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

Solution:
This was simple for me but might be confusing for someone who is new to workflow and doesn't understand difference between WSS vs MOSS.

Microsoft.Office , infact anything in the namespace is specific to MOSS only and is not available in WSS installation. That doesn't mean you cant write a workflow, but certainly we cant use the MOSS specific features in this workflow.

So to proceed further , follow these steps :

1. Go to project references
--> Remove Microsoft.Office.Workflow.Tasks binary reference

2. Go to Workflow class ( i.e. Workflow1.cs )
--> Remove using Microsoft.Office.Workflow.Utility;

3. Go to feature.xml file
-->Remove these lines
ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"

3 comments:

amit May 21, 2009 at 9:01 AM  

on debugging it giving me error cannot complete this action. please try again.

can you please help me.

Sandeep K Nahta May 21, 2009 at 12:28 PM  

Enable debugging using the following setting in Web.config and then check the Logs in 12 HIVE

http://snahta.blogspot.com/2008/08/debugging-sharepoint-error.html

Marion October 12, 2009 at 5:00 PM  

I'm learning SharePoint for the first time and ran into this problem with the Microsoft Virtual labs for Workflow development.

Worked like a charm!

Thank you sir.