Developing Open RIA Services TFS Build and Ria Service  Viewed 70813 time(s), 7 post(s)., 7/18/2013 3:46:05 PM - by Benjamin Hugot

Benjamin-Hugot
Benjamin Hugot 7/18/2013 4:06:38 PM

Hi,

After looking on the web how to build Ria Services on TFS serveur without installing any thing I finally found a way to do it with nugget package but would be great if it was integrate in Official One.  



You need to add to RiaServices.Client package
The following thing in tools:

Install.ps1:
param($installPath, $toolsPath, $package, $project)

try {
    $projectPath = Join-Path $project.Properties.Item("FullPath").Value -ChildPath $project.Properties.Item("FileName").Value
} catch { }

# Add a project import element for the validation targets
#
if ($projectPath -ne $null) {
    $relativeToolsPath = [NuGet.PathUtility]::GetRelativePath($projectPath, $toolsPath)
    $relativeTargetsPath = Join-Path $relativeToolsPath -ChildPath "Microsoft.Ria.Client.targets"

    $rootElement = [Microsoft.Build.Construction.ProjectRootElement]::Open($projectPath)
    $rootElement.AddImport($relativeTargetsPath)
}
------------------------------------------------------
Uninstall.ps1:

param($installPath, $toolsPath, $package, $project) 

try {
    $projectPath = Join-Path $project.Properties.Item("FullPath").Value -ChildPath $project.Properties.Item("FileName").Value
} catch { }

# Remove the project import element for the validation targets
#
if ($projectPath -ne $null) {
    $rootElement = [Microsoft.Build.Construction.ProjectRootElement]::Open($projectPath)

    $targetsImport = $rootElement.Imports | Where-Object {$_.Project -like "*Microsoft.Ria.Client.targets"}
    while ($targetsImport.Parent.Count -eq 1) {$targetsImport = $targetsImport.Parent}
    $targetsImport.Parent.RemoveChild($targetsImport)
}

-------------------------------------------------
Microsoft.ServiceModel.DomainServices.Tools.dll
Microsoft.ServiceModel.DomainServices.Server.dll

-------------------------------------------------
Microsoft.Ria.Client.targets with modified UsingTask

  <UsingTask TaskName="Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask"
             AssemblyFile="Microsoft.ServiceModel.DomainServices.Tools.dll"  />

  <UsingTask TaskName="Microsoft.ServiceModel.DomainServices.Tools.CleanRiaClientFilesTask"
             AssemblyFile="Microsoft.ServiceModel.DomainServices.Tools.dll" />

That could help with Building on TFS server.

Rated 5.00, 2 vote(s). 
27 Reputation 3 Total posts
1
ColinBlair
ColinBlair 7/18/2013 7:19:11 PM

That NuGet package has only been available for two days so I am impressed. I have to do some thinking about your above code, but when Open RIA Services starts releasing NuGet packages something like the above may be involved.

This content has not been rated yet. 
1539 Reputation 130 Total posts
2
Benjamin-Hugot
Benjamin Hugot 7/18/2013 8:24:24 PM

It was not a big deal but i think the best is to do another package because we only need this on the Ria project not in other project referencing the Ria project.

This content has not been rated yet. 
27 Reputation 3 Total posts
3
ColinBlair
ColinBlair 7/18/2013 9:52:18 PM

As someone commented on Jeff's blog when he announced the release of that package, the only piece of WCF RIA Services that wasn't on NuGet was the part that generated the code. If I understand what you did correctly, you managed to get that last piece moved into the NuGet package which has large and interesting implications for Open RIA Services.

Yes, I think this needs to be in a separate NuGet package as we only need this on the project where the code is being generated.

This content has not been rated yet. 
1539 Reputation 130 Total posts
4
JeffHandley
JeffHandley 7/19/2013 1:55:32 AM

Nice!  I'll see if an official package can be created for this.  We have the RIAServices.T4 package out there too, so that really would tie things together nicely.  (Shame on me for overlooking this important piece of the pie).
Do we agree on the package name of RIAServices.Client?

This content has not been rated yet. 
5 Reputation 1 Total posts
5
Benjamin-Hugot
Benjamin Hugot 7/19/2013 5:47:14 AM

Was me on the announcement blog post. The best name would be RiaServices.Client.Generation.
As you here Jeff about nuget how can we do the restore package for a complete solution before Start the build. Because msbuild try to get the Target file before restoring the package. The only way I found was to add the package on another Project which don t need it and remove import line.

This content has not been rated yet. 
27 Reputation 3 Total posts
6
ColinBlair
ColinBlair 7/19/2013 9:34:57 PM

I think we can actually make this a bit simpler. In NuGet 2.5 they added automatic support for .target files. I think if you create a \build folder at the top of the NuGet package and place the targets file there renamed as {packageid}.targets then we will not need the Install and Uninstall scripts.

What I am trying to figure out now is the best replacement for the RIA Link in the project. For the Roslyn branch the need for something like the RIA Link is eliminated completely but the 5 branch still needs something.

This content has not been rated yet. 
1539 Reputation 130 Total posts
7