Friday 10 July 2009

This solution contains resources scoped for a Web application and must be deployed to one or more Web applications

There are quite a few intricacies which can result in following error message during sharepoint workflow deployment.
"This solution contains resources scoped for a Web application and must be deployed to one or more Web applications."
One of such scenarios described here with possible solution.
I was trying to deploy a workflow having InfoPath form on it. But in development machine I don't have MOSS installed. I copied all sharepoint( and sharepoint-workflow) dlls locally. This build fine. No compilation error.
But when I was creating WSP package using WSPBuilder it was giving a warning message:
"Could not resolve: Microsoft.SharePoint.WorkflowActions, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Please define the -DLLReferencePath with the path to the referenced assemblies. However a SafeControl tag for the WorkflowCode.MyWorkflow class has been created."


If you deploy this solution using command line tool in MOSS it gives "This solution contains resources scoped for a Web application and must be deployed to one or more Web applications." error message.

You can still configure this solution from administration UI.

There are two ways to fis this:
1) simply GAC the dll in you development machine. This willl ensure you don't get the warning message in package creation and no error on deployment either.
2) depending on the reference dll's and their trust level WSP builder creates as safe control list. Now when the above dll is not gac'ed WSP builder creates








To deploy this package correctly either delete safe control list manually from the manifest file. Manifest file is located inside generated WSP file.

Alternatively set the "-BuildSafeControls false" in the wspbuilder configuration.

This may not be the best option, but it's solves the issue.

1 comment:

  1. You can add following commands in your batch file. Please replace text placed inside [] bracket as per your requirements.



    @echo off
    ECHO Press any key to start automated of your webpart
    PAUSE

    SET SPAdminTool=%CommonProgramFiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe

    SET wpresourcepath=%CommonProgramFiles%\Microsoft Shared\web server extensions\wpresources

    SET /p TargetWebUrl=Enter Web URL :
    SET PackageName1=[WSP file name]


    echo Adding solution %PackageName1% to SharePoint
    "%SPAdminTool%" -o addsolution -filename "%PackageName1%"

    echo Deploying solution %PackageNam1e%
    "%SPAdminTool%" -o deploysolution -name "%PackageName1%" -url "%TargetWebUrl%" -local -allowGacDeployment -allowCasPolicies -force

    echo Installing feature [Feature name] Deployment ...
    "%SPAdminTool%" -o installfeature -filename "[You feature name]\feature.xml" -force

    echo Activating feature [Feature Name] Deployment ...
    "%SPAdminTool%" -o activatefeature -name "[You feature name]" -url "%TargetWebUrl%"

    PAUSE



    Let me know if this is helpful to you



    Thanks,

    Ashish Chotalia

    ReplyDelete