.NET Forum / Visual Studio.NET / IDE / November 2005
Post-build editbin
|
|
Thread rating:  |
Dave Booker - 26 Oct 2005 19:36 GMT Every time I compile a solution I want it to run "editbin /LARGEADDRESSAWARE" on the resulting .exe.
I have tried putting editbin in the project properties "Post-build Event Command Line", but no matter how I try it won't work. Even if I hardcode the path to editbin (which is not very helpful since the solution is compiled on different computers with difference install paths) it fails without explanation.
I suspect there are some environment or other settings that would enable this to work without hardcoded paths. Any hints?
"Gary Chang[MSFT]" - 27 Oct 2005 10:08 GMT Hi Dave,
>I suspect there are some environment or other settings >that would enable this to work without hardcoded paths. yes, there are some common used environment macro identifiers in the Command Line dialog box, you can click the rightmost button of the command-line edit box to invoke it.
The target command line would be like the following one: editbin /LARGEADDRESSAWARE %TargetDir%%TarGetFileName% > result1.txt
The above command output will be redirect to the result1.txt of the project's directory.
Wish this help!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Dave Booker - 28 Oct 2005 20:04 GMT This isn't working. First of all, it cannot locate the editbin command by itself, and I can't find any environment variables that it might use to find it (e.g., %VCINSTALLDIR% is not defined in whatever mysterious environment the post-build uses).
I can hardcode the path to editbin, which isn't very useful because I use dev machines with different install structuresI think my problem is locating the "editbin" command. But even when I do that the "Post Build Event Failed" and it just says a tool returned an error code from the build event. The > result.txt file is empty.
> Hi Dave, > [quoted text clipped - 24 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. "Gary Chang[MSFT]" - 01 Nov 2005 04:23 GMT >This isn't working. First of all, it cannot locate the editbin command >by itself, and I can't find any environment variables that it might use >to find it (e.g., %VCINSTALLDIR% is not defined in whatever >mysterious environment the post-build uses). It really works on my machine. the Editbin.exe utility is in the Vc7\bin\ directory, its corrsponding path env variable should be auto applied to your current VS2003 IDE's process session.
Can you find the Editbin.exe utility in your VSInstallDir's Vc7\bin\ directory, and would you please tell me could you execute it in the VS2003 Command Prompt console window?
By the way, use the macro TargetPath is more simple: editbin /LARGEADDRESSAWARE %TargetPath% > result1.txt
Thanks!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Dave Booker - 01 Nov 2005 18:26 GMT Editbin.exe is indeed in Vc7\bin\, and it is in the path for my VS2003 Command Prompt (i.e., I can call it from any location with just "editbin").
It seems that there is something wrong with the environment being used for the post-build batch. I checked its environment variables by changing the PostBuild to run "set > chk.txt", and the settings are significantly fewer than what I get in the command prompt. Vc7\bin is not there, and for that matter neither are any of the %target% variables you suggested.
How did this happen to me, and how should I fix it?
Thanks.
"Gary Chang[MSFT]" - 02 Nov 2005 04:14 GMT Hi Dave,
>It seems that there is something wrong with the environment >being used for the post-build batch. Can you execute some other tools(such as sn.exe, dumpbin.exe) in the post-build event command?
The environment variables of the VS2003 IDE's process should be set in the following batch file:
\VSInstallDir\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat
Coulu you find the "@set PATH=%DevEnvDir%;%MSVCDir%\BIN;..." in that bat file? By the way, the %TargetPath% is not a environment variable, it just one of your current project's macros, so it will not in the PATH variables...
Thanks!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Dave Booker - 02 Nov 2005 19:31 GMT I cannot execut sn or dumpbin in the post-build command. They also fail with "'sn' is not recognized as an internal or external command..."
However, vsvars32.bat is in the directory you indicated and does contain the @set PATH as you indicated.
BTW, I guess I should have noted earlier that I am running Windows Server 2003 x64, so the VSInstallDir is "C:\Program Files (x86)", though I don't see how that should hurt....
> Hi Dave, > [quoted text clipped - 13 lines] > one of your current project's macros, so it will not in the PATH > variables... "Gary Chang[MSFT]" - 03 Nov 2005 08:19 GMT Hi Dave,
>However, vsvars32.bat is in the directory you indicated and does >contain the @set PATH as you indicated. > >BTW, I guess I should have noted earlier that I am running Windows >Server 2003 x64, so the VSInstallDir is "C:\Program Files (x86)", >though I don't see how that should hurt..... so this would be the problem, the VS.NET 2003 is not a 64bit application, it doesn't provide the 64bit computable VS.NET utility(editbin, dumpbin). So the PATH variables which is used under x32 system will not be applied to your x64 system's VS2003 IDE process, this is why the environment variables are significantly fewer than what you get in the command prompt.
So in this scenario, I suggest you had better use the x64 specific utility from the latest platform SDK and add its corresponding directory to your system's PATH environment variable.
Thanks!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|