Considerations When Using TFS for SharePoint And Silverlight Development
During testing of my recent TFS migration we found a small issue with a SharePoint Application Page build that had some embedded Silverlight in it where the ClientBin directory was not being created by TeamBuild.
The error looks similar to the following:
MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets(60,3): error MSB3021: Unable to copy file “ClientBin\Base.Silverlight.
.xap” to “ \ “. Could not find a part of the path ‘ClientBin\ .xap’.
So why does this happen? There could be a couple reasons you might be running into this particular error, the largest of which is the default settings of TFS not checking in the XAP files. Which doesn’t make a ton of sense. Also, you will generally run into this error when a Siliverlight project is renamed and its parent directory is renamed. Which of these causing the error will determine the appropriate resolution path.
If you are running into this because you think you are hitting the renaming error, then the easiest way to fix it is to unload the project, edit .csproj, and correct the values in the
Firstly, change the referring Content item in the xap file:
- <Content Include="ClientBin\<SOME XAP NAME>.xap" Condition="$(IsDesktopBuild) == true" />
- <None Include="ClientBin\<SOME XAP NAME>.xap" Condition="$(IsDesktopBuild) != true" />
Following, in the AfterDropBuild Target, execute a manual copy of the xap to the _PublishedWebsites folder:
- <Exec Command="xcopy /y "$(MSBuildProjectDirectory)\<BLAH BLAH BLAH>\Debug\Base.Silverlight. <SOME XAP NAME>.xap" "$(MSBuildProjectDirectory)\<BLAH BLAH BLAH>\Debug\_PublishedWebsites\Base\ClientBin"" />
After, you should be good to go!