sharepointvisual-studio-2012wsp

Deploy silverlight xaps to ClientBin in WSP


I have some xaps being built by other projects in my solution and I need the xaps to be included in the resulting WSP.

I have a mapped folder Layouts with a sub-folder ClientBin and then in the csproj I have the following:

<ItemGroup>
  ...
  <Folder Include="Layouts\ClientBin\" />
  ...
  <Content Include="Layouts\ClientBin\*.xap" />
</ItemGroup>
...
<Target Name="BeforeLayout">
  <ItemGroup>
    <XAPFiles Include="..\..\out\$(Configuration)\bin\sl\xap\**\*.xap" />
  </ItemGroup>
  <Copy SourceFiles="@(XAPFiles)" DestinationFolder="Layouts\ClientBin" OverwriteReadOnlyFiles="true" />
</Target>

When I delete the xaps from the destination folder and open the SP project in VS the package manager shows the layouts folder with nothing in it. And then when I build none of the xaps get packaged in the WSP but the copy operation worked local to the project. If I rebuild nothing changes. If I unload and reload the project then build, the WSP does contain the files I need.

This works for my dev box because I can make sure I'm performing all these steps to keep the package manager happy, but it doesn't work on the team build machine. Are there steps I can take to make sure the package manager grabs those xaps or even other ways to achieve what I'm trying to do?


Solution

  • I created empty placeholders in Layouts\ClientBin for all the xaps to be copied.
    This wasn't optimal since it required some manual dependency management, but it works.

    The end result is that the package manager is aware of those files existing when you open the project in VS and that they need to be packaged up into the WSP. The copy operation works as before but now the new files are packaged.