Silverlight XAP File Out of Date When Built with Expression Blend


The latest project I am working on involves some rather tight integration between Silverlight and SharePoint so I'm getting my feet wet with these tools in the SharePoint-o-Sphere.

I recently ran into an issue where the .XAP file that is needed for Silverlight would not update properly whenever I built the solution within Expression Blend.  If I switched over to Visual Studio, then it would work perfectly.  A quick search showed no conclusive fix for this issue so I came up with this bute force workaround:

  1. Close Blend
  2. Open Visual Studio
  3. go to Project -> Properties -> Build Events and enter the line below in the Post-build event (replacing the web name as needed)

xcopy /y "$(TargetDir)$(TargetName).xap" "$(SolutionDir)sample.webClientBin"

After that, the build works fine in both Visual Studio and in Blend.

I should point out that when I initially created this solution the build worked fine in both Blend and Visual Studio.  The Blend build stopped updating the XAP file when I restructured the solution in order to put the projects into Team Foundation Server.  I cannot find anything in the folder structure itself that points to the old folders or structure so I am not sure where this behavior is coming from.

Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Connecting to %s