Geeks With Blogs

News This is the *old* blog. The new one is at blog.sixeyed.com

Elton Stoneman
This is the *old* blog. The new one is at blog.sixeyed.com

[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 Annoying problems , PowerShell scripts , BizTalk | Back to top


Comments on this post: Fixing up Configurations in BizTalk Solution Files

# re: Fixing up Configurations in BizTalk Solution Files
Requesting Gravatar...
we also have this as an msbuild task which you could post alongside this if you want
Left by Mike on Mar 25, 2011 11:27 PM

# re: Fixing up Configurations in BizTalk Solution Files
Requesting Gravatar...
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
Left by Pass4Sure on Nov 19, 2011 10:03 AM

# re: Fixing up Configurations in BizTalk Solution Files
Requesting Gravatar...
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.
Left by non surgical facelift Adelaide on Dec 09, 2011 9:37 AM

# re: Fixing up Configurations in BizTalk Solution Files
Requesting Gravatar...
Thanks a lot for giving this information. This great article
Left by Black Friday 2012 on Nov 06, 2012 4:25 AM

Your comment:
 (will show your gravatar)


Copyright © Elton Stoneman | Powered by: GeeksWithBlogs.net