3

I have a solution which contains multiple projects (csproj & btproj). I'm actually running BizTalk 2013 R2, so I'm developing under Visual Studio 2013. I have many powershell scripts to deploy my applications and I have to enhance them.

I need to read or determine the projects build order of a solution to deploy my assemblies in this order. Ok I can get it under "Project->Project Dependencies", but where are these informations stored ? Or how can I determine them programatically with powershell ?

I tried this script, but it returns 0 dependencies for all my projects. Probably because my solution is 2013, and i'm using v14.0\Microsoft.Build.dll. v12.0\Microsoft.Build.dll return none projects.

Add-Type -Path (${env:ProgramFiles(x86)} + '\Reference Assemblies\Microsoft\MSBuild\v14.0\Microsoft.Build.dll')
$solutionFile = "sln file full path"
$solution = [Microsoft.Build.Construction.SolutionFile] $solutionFile

$projects = $solution.ProjectsByGuid.Values | Where-Object {($_.ProjectType -eq 'KnownToBeMSBuildFormat') -and ($_.ProjectName -notlike '*.BAM') -and ($_.ProjectName -notlike '*.Bindings')}
echo $projects.Count

foreach($project in $projects)
{ 
    echo $project.ProjectName $project.Dependencies.Count
}

Another way is to parse the btproj and csproj files, but it seems to be hard to code for a basic function.

  • this information is not stored anywhere, it is resolved when loading the solution – D.J. Sep 21 '17 at 14:25
  • Do you know how it is resolved ? My idea is to parse all project files (csproj, btproj, ...) to build a dependencies tree and sort it to find an order. I need to do it with `powershell`, does anybody have this script ? – stephanejulien Sep 25 '17 at 06:10
  • 1
    I used Reflection to load assemblies and search dependencies instead of searching build order. This solved my problem, but didn't gave me a script to create a build order. If anybody find it, it could be usefull for the community.. – stephanejulien Oct 04 '17 at 07:38

1 Answers1

0

There is no script to do it, but usually with BizTalk you will want to deploy projects in the following order.

  1. Helper classes
  2. Schemas
  3. Pipelines (could reference helper classes)
  4. Maps (that are will be dependent on schemas and possibly helper classes)
  5. Orchestrations (that can be dependent on helper classes, maps and schemas)
  6. Binding files (that can reference orchestrations, pipelines and maps).

The above of course is only valid if that is how you have structured your projects.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54