64 bit VS2008 Post Build Event Command Line - visual-studio

I'm trying to use the post build command line to get my class library in the GAC.
It is:
"%programfiles%\Microsoft SDKs\Windows\v6.0A\Bin\x64\gacutil.exe" -if $(TargetPath)
I do not see any errors, but my DLL is not getting into the GAC.
However, I can run this from a DOS prompt and it works.
Anything special I need to do to make this command work in VS like this?

The answer is that on a 64 bit system, %programfiles% needs to be replaced with
%ProgramW6432% or %ProgramFiles(x86)%
Thanks for all of the help.

Are you running under Vista, Win7 or Win 2008 and UAC is making Visual Studio run in a non-admin context ? And you are launching the command prompt with admin privileges ?

You might need double quotes around the target: "$(TargetPath)"

Related

MSCOMCTL and MSCOMCTL2 could not be loaded?

Can somebody please help me and tell me what should I do open my project in Visual basic 6? When I open my previous project, I got the error
You can find MSCOMCTL in your SysWOW64 (or system32 on 32 bit systems) and you can register it easily with the regsrv32 command.
regsvr32 c:\windows\syswow64\MSComCtl.ocx
For MSComCtl2 related problem the following worked for me:
Open a command (DOS) prompt in "C:\Windows\SysWOW64" (system32 on 32-bit systems)
Execute (type and hit enter) regtlib msdatsrc.tlb
Visual studio may have removed entries for MSCOMCTL2 when it couldn't find referenced resource so you may have to revert the .vbp file after completing the above command.

PostBuild in Visual Studio 2008 not working under Windows 7 or Windows 8.1

I defined a post-build-event in Visual Studio 2008:
%ProgramFiles%\TortoiseHG\xy.exe
When compiling under Windows 7 or Windows 8.1 (x64) I got the following error-message:
Error 1 The command "%ProgramFiles%\TortoiseHG\xy.exe" exited with code 9009. MyProjektName
The program is here:
C:\Program Files\TortoiseHg
In Windows XP (x86) it is working perfectly - also did I try to set quotation marks but it didn't help. Any ideas what could be wrong? Is it a problem due to the fact that there are two program-paths (one for x86 and one for x64)? But even when I copy the xy.exe to C:\Program Files (x86)\TortoiseHg\, I do get the same error.
Help is appreciated! Thank you.
under Windows 7 or Windows 8.1 (x64)
That's certainly one of the basic problems, Visual Studio is a 32-bit process. The file redirector will act up and redirect any access from c:\program files to c:\program files (x86). To die there, you don't have TortoiseHG installed there.
But not your only problem, the redirection will produce error code 3, not 9009. So you did not get this far yet, 9009 is a general failure code produced when the program you start exits with an error code. Missing double quotes is enough to trigger it, also the program itself failing for whatever reason. Pretty important to look in the Output window for any error message.
Short from an error message we don't know about, you'd get closer with:
%windir%\sysnative\cmd.exe /c "%programw6432%\TortoiseHG\xy.exe"
Which starts the 64-bit command processor, thus ensuring that the file system redirector stays out of the way. The /c option asks it to execute the command that follows and then exit. The %programw6432% environment variable ensures you'll pass c:\program files and not the 32-bit path. Double-quotes around it to ensure that the spaces in the path don't cause misery.
Try $(ProgramFiles) instead %ProgramFiles%. I tried in VS2010 and it works. I suppose in VS2008 too. I normally use quotation, but I don't know if it is necessary.

Issue generating resources in VS.Net 2010, windows 7 64 bit

I am having an issue generating resources in VS.Net 2010, windows 7 64bit. It am able to compile the solution in Visual studio. But when I try to compile the solution in command prompt using msbuild, it fails generating the resources.
I went through the below link and find a solution to get it compiled in command prompt using msbuild.
http://blogs.msdn.com/b/visualstudio/archive/2010/06/19/resgen-exe-error-an-attempt-was-made-to-load-a-program-with-an-incorrect-format.aspx
I used option 2 from the above article.
Before compiling in command prompt I have to execute the below two commands.
CorFlags /32BIT+ /Force Resgen.exe
set RESGENTOOLARCHITECTURE=Managed32Bit
And after finishing the compilation I have to execute the below remove 32 bit command. Other wise it fails in visual studio.
CorFlags /32BIT- /Force Resgen.exe
One weird thing is non of my team members are having any issue with this. I only have the problem.
Could you please let me know why it's only me?
Also any other permanent solution if you have, with out running the above commands again and again.
Thanks in Advance
Sometimes it has issues with the privileges.
Just make sure that you have tried running your command prompt with full privileges.
i.e. Run as administrator

MS C++ 2010 and mspdb100.dll

Microsoft's C++ compiler and linker seem to have an odd relationship with mspdb100.dll. When run from the IDE, of course, the compiler and linker work fine. When running either one from the command line, I get an error.
No problem, I located the DLL and copied it to the directory. Now the compiler works fine, but the linker dies.
I could solve the problem by adding "%VS10%\Common7\IDE" to my PATH, but for various reasons (performance, system purity, OCD, etc), I don't want to do that. Why is this setup so touchy, and is there anything else I can do to solve it?
try running path\to\VC\bin\vcvars32.bat from within your current shell first. This should ensure your command-line setup will match the IDE-setup.
This is not a permanent fix -- you need to do it every time you launch a new shell.
You could probably also find some way to add everything that's in that .bat permanently to the environment variables, but.... like you asked, why the heck doesn't the MS install do that already?
Add Microsoft Visual Studio 10.0\Common7\IDE to your path, and this issue will not exist any more. You will be able to build without running this silly batch file every time.
I noticed when I installed Microsoft Visual Studio 2010 Express that under the "Microsoft Visual Studio 2010 Express" folder in the Start Menu, there is a link to "Visual Studio Command Prompt (2010)", which sets up all the necessary environment variables when opened. That way you shouldn't have to edit you PATH variable.
This shortcut runs the following:
%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
If it's not convenient to use the shortcut, perhaps you could learn something of use from investigating what this .bat file does?
I met same error,it is because we installed a vs2010 x86 version to a x64 system...
Open two folders:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
You will find two cvtres.exe. Righ click, select Properties, then Details. Delete the older version, and cmake will work well.
I hope this may help you.
Thanks to "zhoudongao" # http://bbs.csdn.net/topics/390121452?page=1#post-394768226.
I know this is a bit dated but if anyone's looking for a way to get compiler running from command line; here's what I did to get it running.
I'm using Win7 32bit and Visual Studio 2010. I created a small batch file in C:\Windows. open cmd prompt at C:\Windows as admin, then type the following:
copy con cl.bat
#"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32" %1 %2 %3 %4 %5 %6
#"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\cl" %1 %2 %3 %4 %5 %6
then press f6 and hit enter again.
Obviously the path you will use is the install path to where you installed Visual Studio.
You now have working command line compiler from any location or directory in windows. To test this go to desktop and open cmd prompt as admin; I prefer to use Ctrl+Shift and right click then choose open command prompt here.
At command prompt type "cl" (without quotes) and hit enter. you will see a message "Setting enviroment for using Microsoft Visual Studio 2010 x86 tools"
type "cl" and hit enter again and you will get your compiler info. you're all set to compile.
enjoy!
Maybe it will help somebody...
I solved this problem by adding
PATH += %PATH_TO_VS_IN_YOUR_SYSTEM%/Common7/IDE;
to nvcc.profile.
Of course, %PATH_TO_VS_IN_YOUR_SYSTEM% is actual path to Visual Studio in your system.
Old, but maybe still valid:
For me "C:\Windows\System32" somehow got missing from the PATH variable.
Adding the missing folder to the path solved this error. See also VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder
if you try to run the tools from the windows cmd.exe directly then you need to set the environments by running the vcvars32.bat file which will set the environment for you. instead you can run the visual studio command prompt which will run vcvars32.bat automatically. if you still have the problem then it's definitely the famous path variable problem.
make sure the "path" variable in the environment has the "c:\windows\system32\" value added to it , because the .bat file will need it to configure the VC tools.
this problem and the like usually happen because of installing many development platforms on the machine which might probably change the path variable.
check this..
https://schrievkrom.wordpress.com/2011/01/25/error-cannot-determine-the-location-of-the-vs-common-tools-folder/

gacutil - cannot launch on vista x64

I thought this was a privilege issue but I logged on as admin and still couldn't get more than a brief flash of the command window. I am just double clicking on the exe file I found in the 7.0 sdk
As a side question, can you just go into the GAC manually and delete something??
Cheers,
Berryl
It's a command-line utility. You ran it without arguments (by the sound of it) and it quickly exited. Run cmd.exe and run gacutil from there.
You can also use the Windows Explorer extension to delete assemblies - just browse to C:\Windows\assembly (or whatever your Windows directory is).

Resources