Deploying Silverlight 2 Beta 2 using MSBuild with CruiseControl.Net in Windows 2003 64bit is bit tricky.
Assumption
1) Familiar with MSBuild
2) Familiar with IIS 6
3) Using .Net 3.5 SP1
4) VS 2008
Step by step instruction
1) First error from CruiseControl.net was
(GetFrameworkPaths target) ->
2008-09-20 22:02:06,368 [Moo:DEBUG] C:\Program Files\MSBuild\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.Common.targets(78,9): error : The Silverlight 2 SDK is not installed.
To Fix this just install Microsoft® Silverlight™ 2 Software Development Kit Beta 2
2) Use <Platform>AnyCPU</Platform> to compile
3) In CruiseControl.Net use %systemroot%\Microsoft.NET\Framework\v3.5\msbuild.exe to build.
4) In 64 bit, xap file does not get copied to Web Application project's ClientBin. So make sure to copy compiled xap file from Silverlight project's bin as shown below.
Configuration can be either Debug or Release build.
<Target
Name="Silverlight-Hack">
<PropertyGroup>
<XapFile>$(AppRoot)Moo.Silverlight\bin\$(Configuration)\Moo.Silverlight.xap</XapFile>
<CopyXapTo>$(AppRoot)Moo.Web\ClientBin\</CopyXapTo>
</PropertyGroup>
<MakeDir Directories="$(CopyXapTo)" Condition=" !Exists('$(CopyXapTo)') " />
<Copy SourceFiles="$(XapFile)" DestinationFolder="$(CopyXapTo)" />
</Target>
5) Make sure to add Silverlight 2 mime types in IIS
.xaml application/xaml+xml
.xap application/x-silverlight-app
6) Make sure add ClientAccessPolicy.xml to WCF service project if the Silverlight will be accessing the service from different application domain.
For more information using ClientAccessPolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Conclusion
Hopely, when Silverlight 2 is released some of the bugs mentioned above will be addressed.
0 comments:
Post a Comment