Creating a Silverlight/RIA TFS Build using Visual Studio

1. Do NOT use Visual Studio 2012.

Use Visual Studio 2010 instead. Visual studio 2012 won’t let you configure the build template. Adding projects to build in “Items to build” At process section will bombs up with “Property value is invalid” message. Changing the “Configurations to build” will throws up an “Unable to cast object of type ‘Microsoft.TeamFoundation.Build.Workflow.Activities.PlatformConfigurationList’ to type ‘System.Collections.Generic.List\1[Microsoft.TeamFoundation.Build.Workflow.Activities.PlatformConfiguration\].” error.

2. Change “Copy outputs to drop folder” to false in Build Process Template if necessary.

If you choose not to copy output files to a drop folder in “Build Defaults” section (untick “This build copies output files to a drop folder”, do not forget to change the value of “Copy outputs to drop folder” in Process-Advanced as well. Otherwise, your build will failed with a “TF270006: The drop location for this build was empty. The build definition ‘NrwManualBuild’ (or the build request) must specify a valid UNC path as the drop location for the build. Update the build definition and try again.” message.

3. Change MSBuild version to x86

Sometimes, build process will fail and complains that it could not find Silverlight 4 SDK and you are 100% sure that you’ve installed this in the build machine. Change the MSBuildPlatform in Process-Advanced to x86.

4. Edit project file for all projects that configured with RIA Link.

If you have a problem with the build bombing out in the RIA’s auto generated files, it is because the build server somehow ignored the build order of the solution. To solve this:

add this to the <Project tag

“InitialTargets=”CustomWorkaroundBuildOrderBug”

then add this after last property group and before first item group :


<Target Name="CustomWorkaroundBuildOrderBug">
  <ItemGroup>
    <ProjectReference Include="..\X.Web\X.Web.csproj">
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>
  </ItemGroup>
</Target>

5.Remove all items from Silverlight applications’ tab in the web project’s setting.

If your build process fails because it complains that it can’t copy xap files, try to remove all items from Silverlight applications tab in the web projects’ setting. After doing this, make sure that you copy the file manually after building all the xaps:

<Copy SourceFiles="$(SolutionDir)"
<Project>
  \bin\$(Configuration)\$(XapFilename)"
  DestinationFolder="..\<WebProject>
    \ClientBin"
    Condition="Exists('$(SolutionDir)<Project>\bin\$(Configuration)\$(XapFilename)')"
/>

In web project, comment all the include tag like this one:

<Content Include="ClientBin\<fubar.xap>"  Condition="$(IsRelease) == true"  />

This is a massive hack (i.e would love to know if anyone else found a better way to do it). This will cause the xap file not to be copied if you click right on “Publish”. You can either do it manually or configure publishing profile.

I ended up making the build server to always build in “Debug” configuration and (obviously) release in “Release configuration” and change the include tag to :

<Content Include="ClientBin\<fubar.xap>"  Condition="$(IsRelease) == true"  />
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: