Run an .exe from the build events
-
Monday, June 05, 2006 3:56 PM
I want to run an executable from the "build events" (in the properties) of a c# project.
I tried to write the command as if I would write it in DOS - I tried with or without quotes like the following:
"C:\path\exename.exe -U param1"
or
C:\path\exename.exe -U param1
When I compile my project I get the following error:
Error 80 The command "C:\path\exename.exe -U param1" exited with code 9009. TryOnHost
Any ideas why I can't execute a program from there?
Thanks.
All Replies
-
Tuesday, June 06, 2006 3:57 PMModerator
Your output shows the application did run, it returned an errorcode (9009).
The application is failing; you'll have to give us more information on the application if you need help finding out why the application is failing.
-
Wednesday, June 07, 2006 12:25 PM
I am trying to run "InstallUtil.exe" located by default in "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" when you install the .net framework on a machine.
I am coding a windows service and every time I compile, I have to manually copy the executable to the installation directory and then manually run InstallUtil.exe to uninstall the current version of the windows service and then run InstallUtil.exe to install the new version. I would like to automate this deployment process with the pre/post build events. I know how to deal with copying the files but every time I try to run the InstallUtil.exe I get that error code.
Is there a place where I could find a definition of those error codes? I googled a bit and I haven't found anything meaningful.
Thanks for you help,
Dom.
-
Wednesday, June 07, 2006 10:44 PMModerator
There should be a couple of .InstallLog files and a .InstallState file in the directory of the assembly you're trying to install. If they're there; so they have any useful information in them? -
Saturday, June 10, 2006 2:41 PM
Yes there is a lot in those log files. Maybe that's where I will find the reason why the executable does not terminate properly ... I will try it again on Monday and let you know.
Thx.
-
Thursday, June 15, 2006 3:18 PM
I am also trying to use gacutil in a pre- and post-build event. I get the same crytptic error code (9009). My commands are:
gacutil.exe /u $(TargetName)
and
gacutil.exe /i $(TargetPath)
Do we need a pathname to gacutil?
Is something else wrong?
gacutil is accessible from the VS command prompt.
-
Thursday, June 15, 2006 3:37 PM
When you open the Visual Studio command prompt it will add that location to the path. But when using the pre/post build event this is not the case. You'll have to specify the path, you should be able to use Environment variables if you desire.
Sayed Ibrahim Hashimi
www.sedodream.com -
Thursday, June 15, 2006 3:57 PMModerator
BradFriedlander wrote: I am also trying to use gacutil in a pre- and post-build event. I get the same crytptic error code (9009). My commands are: gacutil.exe /u $(TargetName)
and
gacutil.exe /i $(TargetPath)
Do we need a pathname to gacutil?
Is something else wrong?
gacutil is accessible from the VS command prompt.
$(TargetName) will give errors because it isn't a filename.
$(TargetPath) should work try gacutil.exe /i "$(TargetPath)" instead.
-
Thursday, June 15, 2006 4:20 PM
Here's what finally worked:
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /u $(TargetName)
and
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i $(TargetPath)
The primary problem was the lack of the full pathname to gacutil.exe.
$(TargetName) work because the uninstall takes the assembly name, not the DLL filename.
-
Thursday, June 22, 2006 11:48 AM
Uninstalling form the GAC is correct.
But during installing it should be
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i "$(TargetPath)"
otherwise the error "Excited with code 1 " occurs
-
Thursday, July 05, 2007 11:41 AM
I face the same problem but I have the couple of .InstallLog files but the .InstallState file does not exist
and I can't write the command in post- build command line to allow the service to install automatically without having to install it every time a new build is made
-
Wednesday, December 10, 2008 2:45 PM
I was suffering from same problem, and got the solution from here
a little change $(TargetName) should be with quotes (in my case it was necessary as path contained spaces)
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /u "$(TargetName)"
happy coding ;)- Proposed As Answer by zahid iqbal Wednesday, December 10, 2008 2:46 PM
-
Friday, April 27, 2012 8:26 PM
For those of you working with .NET 4.0 assemblies, which are installed in the .NET 4.0 GAC (i.e. C:\Windows\Microsoft.NET\assembly) rather than the .NET 3.5 and below GAC (i.e. C:\Windows\assembly) then the gacutil.exe that you want to use is the one in the NETFX 4.0 Tools folder. This is the command that works when you compile your C# project to the .NET framework 4:
"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe" -if "$(TargetPath)"

