Elton Stoneman

  Home  |   Contact  |   Syndication    |   Login
  123 Posts | 0 Stories | 3755 Comments | 0 Trackbacks

News

Archives

Post Categories

[Source: http://geekswithblogs.net/EltonStoneman]

Just a quick one this, but useful for mature BizTalk solutions, where over time the configuration settings can get confused, meaning Debug configurations building in Release mode, or Deployment configurations building in Development mode. That can cause issues in the build which aren't obvious, so it's good to fix up the configurations.

It's time-consuming in VS or in a text editor, so this bit of PowerShell may come in useful - just substitute your own solution path in the $path variable:


$path = 'C:\x\y\z\x.y.z.Integration.sln'
$backupPath = [System.String]::Format('{0}.bak', $path)
[System.IO.File]::Copy($path, $backupPath, $True)

$sln = [System.IO.File]::ReadAllText($path)
 
$sln = $sln.Replace('.Debug|.NET.Build.0 = Deployment|.NET', '.Debug|.NET.Build.0 = Development|.NET')
$sln = $sln.Replace('.Debug|.NET.Deploy.0 = Deployment|.NET', '.Debug|.NET.Deploy.0 = Development|.NET')
$sln = $sln.Replace('.Debug|Any CPU.ActiveCfg = Deployment|.NET', '.Debug|Any CPU.ActiveCfg = Development|.NET')
$sln = $sln.Replace('.Deployment|.NET.ActiveCfg = Debug|Any CPU', '.Deployment|.NET.ActiveCfg = Release|Any CPU')
$sln = $sln.Replace('.Deployment|Any CPU.ActiveCfg = Debug|Any CPU', '.Deployment|Any CPU.ActiveCfg = Release|Any CPU')
$sln = $sln.Replace('.Deployment|Any CPU.Build.0 = Debug|Any CPU', '.Deployment|Any CPU.Build.0 = Release|Any CPU')
$sln = $sln.Replace('.Deployment|Mixed Platforms.ActiveCfg = Debug|Any CPU', '.Deployment|Mixed Platforms.ActiveCfg = Release|Any CPU')
$sln = $sln.Replace('.Deployment|Mixed Platforms.Build.0 = Debug|Any CPU', '.Deployment|Mixed Platforms.Build.0 = Release|Any CPU')
$sln = $sln.Replace('.Deployment|.NET.ActiveCfg = Debug|Any CPU', '.Deployment|.NET.ActiveCfg = Release|Any CPU')
$sln = $sln.Replace('.Debug|.NET.ActiveCfg = Deployment|.NET', '.Debug|.NET.ActiveCfg = Development|.NET')
 
[System.IO.File]::WriteAllText($path, $sln)



The script creates a backup of the solution file first, and then fixes up all the configs to use the correct builds. It's a simple search and replace list, so if there are any patterns that need to be added let me know and I'll update the script.

A RegEx replace would be neater, but when it comes to hacking solution files, I prefer the conservative approach of knowing exactly what you're changing.

posted on Tuesday, March 15, 2011 1:26 PM

Feedback

# re: Fixing up Configurations in BizTalk Solution Files 3/25/2011 11:27 PM Mike
we also have this as an msbuild task which you could post alongside this if you want

# re: Fixing up Configurations in BizTalk Solution Files 11/19/2011 10:03 AM Pass4Sure
You know what you are talking about? I think no, because you are talking that Mature and claver. It is too much difficult to live together

# re: Fixing up Configurations in BizTalk Solution Files 12/9/2011 9:37 AM non surgical facelift Adelaide
I don't have any words to appreciate this post. I am really impressed. The person who created this post surely knew the subject well. Thanks for sharing this with us.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: