Posted 23 March 2009 Tweet
The Silverlight Tools don't have multi-targeting support today, so if you want to continue building Silverlight 2 applications (for production sites), while experimenting and learning about the Silverlight 3 Beta, it isn't that easy. On the Silverlight Toolkit team, we leave it up to individual team members to decide what core development environment they want. By having the Silverlight 2 and Silverlight 3 SDKs checked into our source enlistment, our TFS build server can produce Silverlight 2 and Silverlight 3 binaries, and we can also msbuild the same bits on our machines, regardless of the Silverlight Tools, SDK, or runtime installed on our machines. I blogged about this back in late January about "building Silverlight code on machines without the SDK installed," though really it was more about "building Silverlight code for multiple Silverlight versions."On the Toolkit, we have a directory of external tools and engineering resources. One of these contains the Silverlight SDK’s assemblies, libraries, and build scripts, as shown in the video.
You can then use relative paths in your projects or custom build targets to get things rolling.
<Project
ToolsVersion="3.5"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Define the ExternalTools property first -->
<SilverlightBuildResources>$(ExternalTools)\Silverlight\v2.0\</SilverlightBuildResources>
<TargetFrameworkDirectory>$(SilverlightBuildResources)Reference Assemblies\</TargetFrameworkDirectory>
<TargetFrameworkSDKDirectory>$(SilverlightBuildResources)Libraries\Client\</TargetFrameworkSDKDirectory>
<SilverlightRuntimeVersion>2.0.31005.0</SilverlightRuntimeVersion>
</PropertyGroup>
<Import Project="$(SilverlightBuildResources)Microsoft.Silverlight.CSharp.targets"/>
</Project>
And for Silverlight 3 Beta:
<Project
ToolsVersion="3.5"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Define the ExternalTools property first -->
<SilverlightBuildResources>$(ExternalTools)\Silverlight\v3.0\</SilverlightBuildResources>
<TargetFrameworkDirectory>$(SilverlightBuildResources)Reference Assemblies\</TargetFrameworkDirectory>
<TargetFrameworkSDKDirectory>$(SilverlightBuildResources)Libraries\Client\</TargetFrameworkSDKDirectory>
<SilverlightRuntimeVersion>3.0.40217.0</SilverlightRuntimeVersion>
</PropertyGroup>
<Import Project="$(SilverlightBuildResources)Microsoft.Silverlight.CSharp.targets"/>
</Project>
Hope this helps and is useful to you and your development team.
Jeff Wilcox is a software development engineer at Microsoft who leads exciting open source projects on the Windows Azure team. Jeff has been at Microsoft 8 years and is an alumnus of the University of Michigan.
Jeff leads the open source Windows Azure SDK and cross-platform command line tools development team at Microsoft. Offering tooling for OS X, Windows and Linux and SDKs for Node.js, Java, .NET, PHP, Python; the work is open source, licensed under the Apache 2 license.
4th & Mayor is the #1 top-rated social app on the Windows Phone Store with thousands of five star reviews. The best foursquare experience for Windows Phone, it is powered by a Node.js backend running on Windows Azure & Amazon Web Services. Jeff Wilcox is the developer of the app.