Adding missing File Version to exe

M

Mike Scott

..Net 2.0 Compact Framework exe's no longer seem to have a File Version
in the exe's version info. This was correctly added in .Net 1.x CF exe's.

I've tried Neil Cowburn's solution of adding an
AssemblyFileVersionAttribute class but this doesn't work.

So how do I add File Version to an exe? Is there a way to do it using a
post build event?

Cheers,

MikeS.
 
J

jonathanwilliampayne

I haven't found a 'nice' way of adding version resources but one way
that works is to specify a .res file in Project
Properties\Application\Resource\Resource File option.

I made a .res by creating a desktop Win32 C++ project and borrowing the
..res file from there. There is probably a better way to do this by
calling the rc.exe manually.

Jonathan
 
D

Daniel Moth

You are right that the workaround doesn't work but you should be seeing the
file version being set to the assembly version.

Are you trying this in a VB or a C# project? Can you try it in the other and
see if the issue persists?

Cheers
Daniel
 
D

Daniel Moth

The compatibility tab will be there regardless...

Please check the following and get back to me in this thread or directly:
0. Are you using the release (RTM) version of VS2005?
1. Can you try a *new* CF v2.0 csharp project and see if you can see the
file version for that?
2. I am asking the previous question because I am assuming the project with
which you had an issue was an upgraded one.
3. You said you tried a new VB project and it exhibited the same issue.
Presuming that was an exe project, can you try a DLL (class library) project
please?

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Mike Scott said:
Hi Daniel

I'm using C#. I tried creating a VB compact framework project and it
doesn't work either.

In Windows XP the properties dialog for the exe doesn't show any version
info and it looks like the dialog for a legacy exe file, e.g. a DOS app
with a "Compatibility" tab showing.

Attached a couple of screenshots - see no Version tab.

Cheers,

Mike.


--------------------------------------------------------------------------------






--------------------------------------------------------------------------------
 
S

stephenculver

I too am experiencing this issue.

For Dll's the workaround mentioned above WORKS.

However, I need to check the versions on my .exe files from a PC.
Previously I could do this because the file version was the SAME as the
Assembly version. Now nothing is set on the file that can tell me the
version (I even tried looking at other items in the Assembly info, but
nothing seems to come across).

I am using the most recent (FULL) VS2005 and coding in C#. I have
tried the workaround but it does not work. I even tried using a brand
new project so I'm sure it is has no conversion issues.

Is there any way at all to set something on an exe file for the file
version so that you can get it back out on a PC. I know how to get it
out when the assembly is loaded on the PDA, but again I need it to NOT
be loaded and check it from a normal Windows box (I am attempting to
check versions in a custom installation routine).

Thanks
 
S

SteveV

Has anyone found a solution or workaround for this problem. I have
converted a number of projects from VS2003 to VS2005 and have updated
each to use CF2.0. As others have reported, file info is now missing
on all .exe's. Oddly, dll's seem to be fine.

The issue doesn't appear to be limited to projects converted using the
VS2005 wizard as new projects also exhibit this behavior. FWIW, I'm
coding in C#.

Steve
 
S

SteveV

Peter,

Good suggestion and certainly feasible but I'm concerned that since it
can't be automated it's likely to be forgotten between builds.

Steve
 
S

SteveV

Daniel,

Thanks for the suggestion. I've taken a look at the workaround sample
and have tried to duplicate it as follows:

1.) Manually edit the project's .csproj file and add the following
lines just prior to the closing </Project> tag:

<!-- To modify your build process, add your task inside one of the
targets below and uncomment it.
Other similar extension points exist, see
Microsoft.Common.targets. -->
<Target Name="BeforeBuild">
<Exec Command="&quot;$(DevEnvDir)..\..\SDK\v2.0\Bin\rc.exe&quot; /I
&quot;$(DevEnvDir)..\..\VC\ce\atlmfc\include&quot; /I
&quot;$(DevEnvDir)..\..\SmartDevices\SDK\PocketPC2003\Include&quot; /d
&quot;_DEBUG&quot; /d &quot;_WIN32_WCE=0x420&quot; /d
&quot;UNDER_CE&quot; /d &quot;WIN32_PLATFORM_WFSP&quot; /d
&quot;_UNICODE&quot; /d &quot;UNICODE&quot; /l 0x409
/fo&quot;$(Win32Resource)&quot; $(ProjectDir)Properties\dapp.rc" />
</Target>
<Target Name="AfterBuild">
</Target>


2.) Create a "Properties" folder within the project folder and add the
following files to it:

ceux.bin
dapp.aps
dapp.rc

3.) Include the "Properties" folder in the project and confirm that the
..rc file looks ok and is editable.


Unfortunately, compilation fails with the following 2 errors:

EXEC : fatal error RC1107: invalid usage; use RC /? for Help

C:\Documents and Settings\Steve Vibert\My Documents\Visual Studio
Projects\CSharp\PocketPC\iTalk\iTalk.csproj(284,3): error MSB3073: The
command ""C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\..\..\SDK\v2.0\Bin\rc.exe" /I "C:\Program Files\Microsoft
Visual Studio 8\Common7\IDE\..\..\VC\ce\atlmfc\include" /I "C:\Program
Files\Microsoft Visual Studio
8\Common7\IDE\..\..\SmartDevices\SDK\PocketPC2003\Include" /d "_DEBUG"
/d "_WIN32_WCE=0x420" /d "UNDER_CE" /d "WIN32_PLATFORM_WFSP" /d
"_UNICODE" /d "UNICODE" /l 0x409 /fo"dapp.res" C:\Documents and
Settings\Steve Vibert\My Documents\Visual Studio
Projects\CSharp\PocketPC\iTalk\Properties\dapp.rc" exited with code 1.

Regards,

Steve
 
G

Guest

You also need

<Win32Resource>$(TargetDir)dapp.res</Win32Resource>

in the first <PropertyGroup> tag in the .rc file.

This worked for me.

:
 
S

SteveV

Dodzi,

Thanks for the suggestion. I had actually caught that shortly after my
post on 3/17 but was still getting the same error. I had pretty much
given up on the problem but decided to have another look at it this
morning. The problem; missing escaped double quotes (&quot;) around
the following:

$(ProjectDir)Properties\dapp.rc"

When expanded, the project directory path for this project includes
spaces and was causing the error. It's always the simple things that
kill you :p

Regards,

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top