1

I've got a VS2010 project that contains an AssemblyInfo.cs file. This has:

[assembly: AssemblyFileVersion("10.0.1.0")]

When I run my app and ask for the file version from the executing assembly it picks up 10.0.1 no problem. However, if I right-click on the .exe file in Windows Explorer and open the properties dialog - the Details tab shows a File Version of 10.0.0.0(!)

Why doesn't Windows see 10.0.1 for the file version? I must be missing something...

Additional info: If I add a Version Resource to my app's .res file then the information shows up in the compiled executable, but if I don't have the info in the Version Resource the compiled exe ignores the file and "informational" (i.e. Product) version attributes in AssemblyInfo.cs.

Joel Brown
  • 14,123
  • 4
  • 52
  • 64
  • 1
    Are you sure you're looking at the right EXE (maybe it has different output path)? Or maybe you've updated the AssemblyInfo.cs in a DLL project and forgot about the one that produces EXE. – Denis Ivin Mar 14 '11 at 22:56
  • The solution is pretty simple. There is only the one Windows Forms project being compiled. I'm sure that I'm looking at the right EXE. – Joel Brown Mar 14 '11 at 22:59
  • Is the Build Action for AssemblyInfo.cs set to Compile? Are you sure you're not looking at a Debug version when you're doing a release build? – rsbarro Mar 14 '11 at 23:02

2 Answers2

2

Do you have, by any chance a .RC or .RES file included in your project that contains a Version-Resource Definition? Maybe a custom build target or script adds it? If that is the case, it would be picked up instead of the version defined in AssemblyVersion.cs (at least that is what Michael Kaplan says here).

In that article series he also shows that the version information from a ".MUI" file could overlay the version information from the actual EXE file - although, if I understand that correctly, is only an "issue" with native/unmanaged builds.

Community
  • 1
  • 1
Christian.K
  • 47,778
  • 10
  • 99
  • 143
  • I think that what has happened is that when I added a .res file the AssemblyInfo.cs started being ignored. I ended up using the version resource in the .res file since things weren't flowing through from the AssemblyInfo.cs file. – Joel Brown Mar 16 '11 at 00:18
  • Thanks, I wouldnt have figured this out. WIX was complaining that it couldn't find !(bind.FileVersion...), and this did the trick – schultz Sep 23 '16 at 11:04
0

I am on VS2008 for SmartDevice development. After changing the version number in AssemblyInfo.cs to "2.1.*" , I found it impossible to revert the change. No matter what I do.

After removing the <project_name>.suo, bin/ *, obj/ *, cleaning/rebuilding in release, debug mode, nothing seems to make any difference.

Finally I uninstall the app from CE device first, and retried again. This time, Assembly.GetExecutingAssembly().GetName().Version starts to report the correct version.

Ben
  • 1,133
  • 1
  • 15
  • 30