Re: Set file version from powershell

Skip to first unread message

Marco Shaw [MVP]

Mar 27, 2009, 11:28:15 AM3/27/09
David wrote:
> Is it possible to set a files "File Version" attribute from powershell. I
> want to loop through a directory and set the "File Version" attribute of all
> files within the directory to (lets say

That seems to be a read-only property in .NET. I'll keep looking and
maybe someone else might have an idea...


*Microsoft MVP - Windows PowerShell
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*PowerShell Co-Community Director -
*Blog -

Vadims Podans

Mar 27, 2009, 12:26:19 PM3/27/09
Yes, this property may be changed using these programs, such ResHacker or
Restorator. However I don't sure that this is good solution.
WBR, Vadims Podans
PowerShell blog -

"Marco Shaw [MVP]" <> rakstīja ziņojumā

Joel Bennett

Mar 28, 2009, 12:19:07 AM3/28/09
Uhm... I think this would be a good time to ask for a little bit more
clarification on what you're trying to accomplish.

Are you trying to *change* the file version on dlls or executables, or
set it on files that don't have a version already in hopes of tracking
something that way?
Joel "Jaykul" Bennett

Josh Einstein

Mar 29, 2009, 1:26:22 PM3/29/09
There's a .NET version (which is a part of the strong name, which is a part
of the IL metadata) and there's a Win32 version. A versioned .NET assembly
must be strong-named which means you can't change anything about the
assembly after it's compiled otherwise the signature would be invalid and
the assembly would fail to load.

The Win32 information (which is also applicable to .NET assemblies and
independent of the .NET version) can be changed by editing the appropriate
resource but the same caveat applies. If the file is signed, changing the
resource will break the signature.

And finally one last bit of useless trivia... even though the version of a
.NET assembly is added using the AssemblyVersionAttribute and
FileVersionAttribute, many developers are surprised to learn that these
attributes don't actually exist in the compiled assemblies. They are special
and are converted to the appropriate metadata by the compiler.


"Marco Shaw [MVP]" <> wrote in message


Apr 1, 2009, 4:08:02 AM4/1/09
I currently have a build process hosted within cruise control. All my
assemblies are versioned, built, unit tested, analysed with fxcop, archived
and deployed to development environment every night. One of the projects is
a web application that contains css, js, images. I want to set the version
of these files to the build number from cruise control so that all content
deployed to an environment is versioned. This allows me to run regular scans
on 5 environments for files that are no longer needed and can be removed.


Mar 16, 2019, 3:48:32 AM3/16/19
I am also facing problem of setting version info after compilation. Iam ready to resign the files after changing version. But how to change version of executables is the question?
Reply all
Reply to author
0 new messages