Deployment issues using Visual Studio 2008 SharePoint Workflow project templates (Access is denied.)

Standard
The addition of SharePoint sequential and state machine workflow project templates to Visual Studio 2008 did wonders for SharePoint workflow developers. Specifying SharePoint Debug Settings that allow you to do a “right-click Deploy” that GACs the DLL, installs and activates a workflow on a SharePoint instance, and associates it with a SharePoint list on that instance eliminates a lot of manual steps.
 
There is one issue, however, that arises when the workflow project is under source control. This issue yields the following errors in Visual Studio:
 
“Access is denied.”
with
“Cannot copy workflow.xml to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\[Project Name]\workflow.xml.”
or

“Cannot copy feature.xml to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\[Project Name]\feature.xml.”

 
Unfortunately for the first few months I just dealt with this issue using this workaround:
 
1. Open the path to the workflow feature folder.
2. Delete feature.xml and workflow.xml.
3. Go back to Visual Studio and click Deploy.
 
I finally realized that when the Deploy command in Visual Studio for the workflow projects does a copy of the feature files to the 12 hive, it copies the read-only attribute as well if you do not have those files checked out in source control.
 
If you are having this issue, simply check out feature.xml and workflow.xml from source control and your deployments with SharePoint workflow project templates should no longer have this error.

10 thoughts on “Deployment issues using Visual Studio 2008 SharePoint Workflow project templates (Access is denied.)

  1. michelle

    The folder I am referring to is the feature folder. In my case it was: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\testwf

  2. Fixed my own problem.

    Solution (for me at least) was to download the Sharepoint server 2007 sdk and after installing doing a devenv /resetsettings in visual studio commandprompt.

    Cheers

  3. Hi Alex,

    I have the same problem as bob z described above.
    I have built a system in vmware as described in the article
    http://www.pptspaces.com/sharepointreporterblog/Lists/Posts/Post.aspx?ID=28
    If that is familiar to you.

    I am logged in as administrator and the processes are running in the same account.

    Visual Studio 2008 sp1
    MOSS server sp1
    Windows server 2003 R2 (latest sp)
    I’ve created a simple workflow and pressed f5.

    Shown in the output:

    —— Build started: Project: SharePointWorkflow2, Configuration: Debug Any CPU ——
    c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.Office.Workflow.Tasks.dll” /reference:”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll” /reference:”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.Search.dll” /reference:”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.WorkflowActions.dll” /reference:”C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll” /reference:”C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll” /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Design.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.Design.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:”C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Workflow.Activities.dll” /reference:”C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Workflow.ComponentModel.dll” /reference:”C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Workflow.Runtime.dll” /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:”C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll” /debug+ /debug:full /filealign:512 /keyfile:key.snk /optimize- /out:obj\Debug\SharePointWorkflow2.dll /target:library Properties\AssemblyInfo.cs Workflow1.cs Workflow1.designer.cs Properties\Settings.Designer.cs “C:\Documents and Settings\Administrator\Local Settings\Temp\xodwbvvg.cs”

    Compile complete — 0 errors, 0 warnings
    SharePointWorkflow2 -> C:\Projects\SharePointWorkflow2\SharePointWorkflow2\bin\Debug\SharePointWorkflow2.dll
    —— Deploy started: Project: SharePointWorkflow2, Configuration: Debug Any CPU ——
    Successfully installed this assembly into the global assembly cache: SharePointWorkflow2.dll.
    Successfully restarted Internet Information Services (IIS).
    Successfully copied workflow.xml to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\SharePointWorkflow2\workflow.xml.
    Successfully copied feature.xml to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\SharePointWorkflow2\feature.xml.
    Failed to install the workflow template to Microsoft Office SharePoint Server.
    Access denied.
    Failed to deploy the workflow template to Microsoft Office SharePoint Server.
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

    Somewhere someone made the off-hand remark that it migth be different templates for moss and wss and that the templates in visual studio was incorrect. Giving me the error.

    However I do not know how to verify that and I cant find my way back to that comment.

    Any suggestion is appreciated.

    Regards

    Greger

  4. bob z

    Thanks again for the quick response and thanks for URL. I will check out the evolving guidance.

    For the record, as soon as I switched to Virtual PC and reconfigured, sample task workflow deployed as advertised.

    I have no idea what led to initial problem but I had tried several times with several examples on Virtual Box. You lose some and you win one.

    Regards.

  5. bob z

    Thanks a lot for responding so quickly, especiallly the comment about the safe control entry. I wasn’t sure.

    I did nothing to debug settings. I haven’t tried a stsadm command yet. I am running Visual Studio as the virtual machine administrator.

    I’ve found that the virtual machine where I was working was no longer letting me even access the SharePoint Central Admin which leads me to believe the vm was hosed somehow. (Central admin appeared to be up in IIS.) It could also be the virtual machine software I used (Virtual Box) was the issue.

    I am presently creating a new virtual machine (with MS Virtual PC) with Windows Server 2003, Visual Studio 2008 and of course MOSS. I am running Visual Studio as administrator and I will try again to do the workflow sample for tasks that I found at rshelton.com.

    The Visual Studio 2008 method of moving workflows appeals to me because it appears to take care of all the moving and activating, but I guess the downside is when it fails, it’s a little harder to figure out.

    I will leave you another note after trying the process with my new setup. Regards.

  6. Alex Nichols

    Bob,

    A couple questions:
    Are you setting the SharePoint Debug Settings to install the workflow to a local SharePoint site?
    Are you able to run STSADM commands without getting Access Denied errors from the command prompt using this account?
    Are you running Visual Studio as Administrator? Could be a Vista UAC issue.

    The web.config should not need a safe control entry if the workflow dll is in the GAC.

  7. bob z

    Here’s some more info from the output log:

    Failed to install the workflow template to Microsoft Office SharePoint Server.
    Access denied.
    Failed to deploy the workflow template to Microsoft Office SharePoint Server.

  8. bob z

    Hi Alex,

    Thanks. This was useful in helping me understand the process.

    When I press the deploy button for my workflow in Visual Studio 2008, I get “Access denied.” with no other explanation. I look in the appropriate folder on the SharePoint server and see that the feature.xml and the workflow.xml have been copied as expected so i’m guessing I have a different issue. Also the workflow dll appears in GAC.

    I do not see the workflow dll marked as safe in the virtual directory web.config though. is that important here?

    I have given the administrator account that is creating the workflow in VS2008 full permission for the sharepoint site (also on same virtual machine), but when deploying this workflow I still get access denied. Workflow is a simple task workflow with no forms.

    Any ideas greatly appreciated.

    Regards,

    bob

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s