Silverlight 5

biqt's Avatar

biqt

16 Sep, 2011 09:57 AM

Good morning!

It seems that AppHarbor doesn't support Silverlight 5 yet — I've got an error:
error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

What about installing Silverlight 5 RC? This would be very much appreciated. Afaik, this shouldn't be too difficult; I have deployed it on our build server. Installing Silverlight 5 RC SDK should be enough (http://www.silverlight.net/downloads).

Thanks in advance!
——
Victor

  1. Support Staff 1 Posted by friism on 16 Sep, 2011 11:21 AM

    friism's Avatar

    Hi Victor

    We're not keen on installing pre-release libraries on our build servers. The main problem is that if we install the Silverlight 5 RC, and then upgrade when the RTM shows up, then, if your code relies on behaviour present in the RC that changed in the RTM, your code won't build after the upgrade.

    You might want to look into adding a local version of the SL 5 targets file to your repository and referencing that from your project file, also making sure to include required SL 5 dlls.

    Please let us know if you get this working or if there are other ways we can be of assistance.

    Michael

  2. friism closed this discussion on 16 Sep, 2011 11:21 AM.

  3. biqt re-opened this discussion on 16 Sep, 2011 03:15 PM

  4. 2 Posted by biqt on 16 Sep, 2011 03:27 PM

    biqt's Avatar

    You might want to look into adding a local version of the SL 5 targets file to your repository and referencing that from your project file, also making sure to include required SL 5 dlls.

    Well, I will try some MSBuild magic in a sandbox at first... But SL binaries are rather large to be placed in source repository. Does AppHarbor support subrepos for Mercurial repositories? (I'm using Bitbucket to store source code.)

  5. Support Staff 3 Posted by friism on 16 Sep, 2011 03:41 PM

    friism's Avatar

    For Bitbucket-hosted repositories, the subrepository behaviour depends on what Bitbucket places in the tarball that we download from them, and I must admit that I haven't tested.

    Michael

  6. 4 Posted by biqt on 16 Sep, 2011 09:36 PM

    biqt's Avatar

    Good evening, Michael!

    ...the subrepository behaviour depends on what Bitbucket places in the tarball that we download from them, and I must admit that I haven't tested.

    Unfortunately, subrepo with binaries failed to be fetched.

    Please let us know if you get this working...

    As far as I can see this looks like be working. Maybe the further exploration will reveal some issues but at least TPL (wich is absent in SL4 but present in SL5 RC) is resolved in compile and run time.

    Suggested solution “just works” for my sandbox purposes, but in prodution environment build engineer should add some conditions, define some auxiliary variables, etc, for safety and reliability of build scripts.

    The build target for standard Silverlight 5 project is placed in Microsoft.Silverlight.CSharp.targets wich is found under $(MSBuildExtensionsPath32). This is reserved MSBuild property, and one should avoid redefining it. But, once more, for my purposes it was just appropriate way.

    Investigation showed that problem with unfound paths is caused by ValidateSilverlightFrameworkPaths task in GetFrameworkPaths target. Some Reflector inspection of Microsoft.Silverlight.Build.Tasks.dll exposed the exact meaning of the key properties $(TargetFrameworkDirectory), $(TargetFrameworkSDKDirectory) and $(SilverlightRuntimeVersion). In specific environment with SL5 RC installed (SL4 also worth looking at) these properties can be viewed with “printf” during build:

    <Target Name="AfterBuild">
      <Message Importance="high" Text="TargetFrameworkDirectory: $(TargetFrameworkDirectory)" />
      <Message Importance="high" Text="TargetFrameworkSDKDirectory: $(TargetFrameworkSDKDirectory)" />
      <Message Importance="high" Text="SilverlightRuntimeVersion: $(SilverlightRuntimeVersion)" />
    </Target>
    

    (I hope Markdown won't eat all my tags.) This gives a hint how to (re)define these properties manually.

    So, what I've done. In folder $(SolutionDir)Externals\Silverlight.5.0.60818.0\ I placed following subdirectories (long suffixes can be omitted, one level is just enough):

    1. ReferenceAssemblies\Microsoft\Framework\Silverlight\v5.0\ — copied from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\;
    2. MSBuildExtensions\Microsoft\Silverlight\v5.0\ — copied from c:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\;
    3. MicrosoftSdks\Silverlight\v5.0\Libraries\Client\ — copied from c:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Libraries\Client\;
    4. MicrosoftSdks\RIA Services\v1.0\Libraries\Silverlight\ — copied from c:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight\.

    Then modified default build script (Silverlight 5 *.csproj-file).

    1. Some definitions at the beginning:

       <PropertyGroup>
         <Biqt_Externals>$(SolutionDir)Externals\</Biqt_Externals>
         <Biqt_ExternalsSilverlight>$(Biqt_Externals)Silverlight.5.0.60818.0\</Biqt_ExternalsSilverlight>
       </PropertyGroup>
      
    2. Target version set to 5.0:

       <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
      
    3. (Re)defined properties used by standard targets before importing Microsoft.Silverlight.CSharp.targets:

       <PropertyGroup Condition="$(SilverlightVersion) == 'v5.0' and !Exists('$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets')">
           <MSBuildExtensionsPath32>$(Biqt_ExternalsSilverlight)MSBuildExtensions\</MSBuildExtensionsPath32>
           <MSBuildExtensionsPath>$(Biqt_ExternalsSilverlight)MSBuildExtensions\</MSBuildExtensionsPath>
           <TargetFrameworkDirectory>$(Biqt_ExternalsSilverlight)ReferenceAssemblies\Microsoft\Framework\Silverlight\v5.0\</TargetFrameworkDirectory>
           <TargetFrameworkSDKDirectory>$(Biqt_ExternalsSilverlight)\MicrosoftSdks\RIA Services\v1.0\Libraries\Silverlight\;$(Biqt_ExternalsSilverlight)\MicrosoftSdks\Silverlight\v5.0\Libraries\Client\</TargetFrameworkSDKDirectory>
           <SilverlightRuntimeVersion>5.0.60818.0</SilverlightRuntimeVersion>
       </PropertyGroup>
      
  7. Support Staff 5 Posted by friism on 17 Sep, 2011 08:27 AM

    friism's Avatar

    Thanks for sharing Victor!

    Michael

  8. friism closed this discussion on 17 Sep, 2011 08:27 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac