Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am beginner. Is their any Microsoft Tool available or Visual Studio Utility through which I can update all assemblyinfo.cs files from Solution folder. Their are 8 projects in solution folder I wantto update
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
of all assemblyinfo.cs files except one project. I want only one line commandline to update this. Not more than that can anybody help me on it?
Posted
Comments
Andreas Gieriet 5-Jun-15 7:58am    
Why one-liner only? In any shell script, I can concatenate the lines into one line if you wish...
What did you try?
Cheers
Andi
Richard MacCutchan 5-Jun-15 12:06pm    
Ctrl+Shift+H allows you to edit multiple files.
Sergey Alexandrovich Kryukov 5-Jun-15 12:28pm    
You hardly can do it in one line. You can write some application which can be launched in one line, but this is a very easy problem. What have you tried so far?
—SA
Ashutosh Kakade 9-Jun-15 3:10am    
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;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900