5

My understanding (which may well be faulty) is that it is easy to set the OriginalFilename property for a C++ DLL or EXE by including a VERSIONINFO resource file in the Visual Studio build.

But I can't find any way of setting OriginalFilename for a C# build. It is apparently always set to the name of the output file being built.

I'd really like to be able to specify this if possible. Any ideas? Thanks.

RenniePet
  • 11,420
  • 7
  • 80
  • 106

3 Answers3

2

OK, no answers, and now I've found a workaround.

This article here at StackOverflow was very helpful: How do I set the version information for an existing .exe, .dll?

Which led me to this resource manipulation project written in C#: http://resourcelib.codeplex.com/

So what I'm going to do is to modify the DLLs after they've been built.

Edit (March 2015): This is an old posting, but I can see there is still some interest in it. The "ResourceLib C# File Resource Management Library" open source project has moved since four years ago, and is now here: https://github.com/dblock/resourcelib

Community
  • 1
  • 1
RenniePet
  • 11,420
  • 7
  • 80
  • 106
  • Have you been able to modify the FileInformations using resourceLib? – Sebastian Mar 04 '15 at 10:48
  • @JMat: Yes, this is still working for me. Although I should perhaps mention that I'm still targetting .Net Framework 3.5. Maybe if/when I update to later versions the .dll files will be sufficiently different that it won't work - I don't know. – RenniePet Mar 04 '15 at 12:24
1

Yes it is possible to set it, -> right-click on the project or assembly name in visual studio -> select properties -> select Application tab -> change the assembly name as you want.

Please refer the link to view property window, in which assembly name option is there

After changing the name compile the project,(to verify the change) right click your compiled DLL file and select properties and click on 'Details' tab, in which you can see the 'original filename' is now changed.

chirag pathak
  • 121
  • 1
  • 14
0

Sadly, no.

You can read what it is with System.Diagnostics.FileVersionInfo.OriginalFilename, but the value is filled by the Project / Output Filename not from any Assembly Attribute.

Running your patch program to change it after a build runs the risk of breaking any digital signature applied during the build. You may need to build without signing, patch the attributes, then sign it in a separate step.

Jesse Chisholm
  • 3,857
  • 1
  • 35
  • 29
  • 1
    "You may need to build without signing, patch the attributes, then sign it in a separate step." Yes, I apply the company's code signing certificate in a later step. – RenniePet Feb 02 '15 at 03:43