Problem: This solution contains resources scoped for a Web application..

Sep 2, 2008 at 4:08 PM
Hi all, we're very impressed with what this installer is able to do, however we need a little help!

We have created a really basic C# web part via VS2008 using the WSS Extensions.  Through VS2008 we have been able to build and deploy the web part and it then shows on our WSS site.

We wanted to try and package this simple web part before we tried anything more complicated but appear to have got stuck!  We have opened the Sharepoint Solution Installer project and then added the WSP file from our sample web part to the Resources directory.  We've changed the App.Config (Setup.exe.config) so that all of the settings are 'apparently' correct.  We then build the solution and run it.  Firstly the Installer enables us to retract the web part that we initially deployed through VS2008.  However when we then try to use the Installer to deploy our web part it firstly passes all of the checks, we then go past the screens for EULA and which Site to deploy to, all fine. 

However, its when the installer gets to the progress bar 'Creating and deploying solutions to all Web Applications' it fails.  It then rolls back and gives the following message:

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

Clicking Next then displays the full error which I can post if required.

What are we doing wrong?  Any help would be really appreciated.

Cheers

Pete.
Sep 8, 2008 at 2:29 PM
Hi -

Rather than create another thread, I'll add to this because I have the same error.

Here is my config file contents:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="BannerImage" value=""/>
    <add key="LogoImage" value=""/>
    <add key="EULA" value=""/>
    <add key="SolutionId" value="db726300-bb3d-4f3a-a7c6-958d536c3047"/>
    <add key="SolutionFile" value="mywsp.wsp"/>
    <add key="SolutionTitle" value="mytitle"/>
    <add key="SolutionVersion" value="1.0.0.0"/>
    <add key="FeatureScope" value="Web"/>
    <add key="FeatureId" value=""/>
    <add key="UpgradeDescription" value="mydescription"/>
    <add key="RequireDeploymentToCentralAdminWebApplication" value="false"/>
    <add key="RequireDeploymentToAllContentWebApplications" value="false"/>   
  </appSettings>
</configuration>

I have a wsp with multiple features: a web part and 4 List templates. All of the List Template Features are dependent on the web part Feature. All Features are set to Scope="Web".

I realise in the docs it says "Features scoped to the WebApplication or Web are not currently supported. The installer only supports installing a single feature within your WSP." but I thought I'd try it.

I get this msg when I run Setup.exe: "This solution contains resources scoped for a Web application and must be deployed to one or more Web applications."

Is there a way round this for Scope="Web"?

cheers,

Steve
Developer
Sep 15, 2008 at 1:34 PM
See the following issue I just created on this.  There may be a workaround:

http://www.codeplex.com/sharepointinstaller/WorkItem/View.aspx?WorkItemId=11302
Oct 27, 2008 at 12:53 PM
Edited Oct 27, 2008 at 1:59 PM
Hi,

i ran into the same error and fixed it this way.

I got the VS-Solution (sourceCode) and debugged it with my own .wsp stepping through the code.

When installing my solution in debugmode i found the following issue in the InstallProcessControl.cs.
Set your breakpoint to line 217.
There is an if-else block testing the options.WebApplicationTargets property for null, but it does not test the Count of this property for 0.
So the object was instantiated, but was empty. The if clause if (options.WebApplicationTargets != null) was true and the wrong decision was made, because in fact this property was empty.

I found the property options.targets got 3 (in my case) elements instead.

So changing the  code to:

          if (options.WebApplicationTargets != null && options.WebApplicationTargets.Count>0) //added && options.WebApplicationTargets.Count>0
          {
            executeCommands.Add(new CreateDeploymentJobCommand(this, options.WebApplicationTargets));
          }
          else
          {
            // KML TODO - need to get rid of options.Targets? - check with Lars
            executeCommands.Add(new CreateDeploymentJobCommand(this, options.Targets));
          }

made it working to me.

But with my less background-knowledge to this software, i ask myself, if this is a correct fix or if this just works in my case and has other negative sideeffects i`m just not seeing in the moment.
Is there a core developer out there, who could please confirm this issue or correct me if im wrong?

Thanks a lot!!

cheers,
kai







Jan 8, 2009 at 7:58 AM
Do you still have the source code, it doesnt appear to be avaiable for download here.

I am gettting the follwing error:-

***** SOLUTION DEPLOYMENT *****
***** ERROR *****
This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.
CodePlex.SharePointInstaller.InstallException: This solution contains resources scoped for a Web application and must be deployed to one or more Web applications. ---> Microsoft.SharePoint.SPException: This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

I would like to have a look at the source
Jan 8, 2009 at 8:06 AM
Hi,

you can get the source of the v1.2 release on this page and modify the class as described above. Thats all.

Easier, you can download a fixed exe from Tobias Lekman.
http://www.codeplex.com/lekman/Release/ProjectReleases.aspx?ReleaseId=20133

Cheers,
Kai
Coordinator
Mar 29, 2009 at 6:35 PM
This bug is now fixed in version 1.2.1