Click here to Skip to main content
15,914,225 members

Comments by Ashutosh Kakade (Top 3 by date)

Ashutosh Kakade 9-Jun-15 3:10am View    
I had written powershell script. But the requirement was one liner which i think is too complex to achieve. Here's my script
/*Powershell Script*/

function Update-SourceVersion
{
Param ([string]$Version)
$NewVersion = 'AssemblyVersion("' + $Version + '")';
$NewFileVersion = 'AssemblyFileVersion("' + $Version + '")';

foreach ($o in $input)
{
Write-output $o.FullName
$TmpFile = $o.FullName + ".tmp"

get-content $o.FullName |
%{$_ -replace 'AssemblyVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', $NewVersion } |
%{$_ -replace 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)', $NewFileVersion } > $TmpFile

move-item $TmpFile $o.FullName -force


}
}

function Update-AllAssemblyInfoFiles ( $version )
{
foreach ($file in "AssemblyInfo.cs", "AssemblyInfo.vb" )
{
get-childitem -recurse |? {$_.Name -eq $file} | Update-SourceVersion $version ;
}
}
$version1=Get-Content C:\Users\Ashutosh\Desktop\testapp\testapp\buildVersion.txt
Set-Location C:\Users\Ashutosh\Desktop\testapp\testapp;
Update-AllAssemblyInfoFiles $version1;
Ashutosh Kakade 21-Nov-14 3:48am View    
Thanks for responding Praneet.
But application is deployed on Windows Server 2008 R2. VS2013 .NET Framework is not installed on it so we are building web application through Bamboo. Its a tool where we can build and deploy web application. Doing so encountered an error.
Ashutosh Kakade 21-Nov-14 3:02am View    
Deleted
Thanks for responding Praneet.
But application is deployed on Windows Server 2008 R2. VS2013 .NET Framework is not installed on it so we are building web application through Bamboo. Its a tool where we can build and deploy web application. Doing so encountered an error.