In another answer to this question, @akira said :
All you have to do is run a visual studio-command prompt, OR include the environment for that invitation in your / powershell / emacs -environment shell. Look at vcvars32.bat and what it does; it is located somewhere in the visual2008 installation folder.
Taking this sentence, I created an Emacs lisp file to configure my environment in Emacs for Visual Studio 2010. To create this file, I first grabbed the environment settings from a regular command line, and then did the same with the Visual Studio Command Prompt:
set > set_ordinary.txt set > set_vs2010.txt
Then I found the differences between them using the file delimiting tool for Windows . The following emacs lisp code is the result of my efforts. Just copy its contents to the .emacs file or, better, save its contents to vcvars32-2010.el and put it in load-path .
;;; vcvars32-2010.el --- Create Visual Studio Command Prompt (2010) environment settings ;; Environment settings for: ;; Visual Studio 2010 Professional ;; Version 10.0.40219.1 SP1Rel ;; ;; Microsoft .NET Framework ;; Version 4.5.50938 SP1Rel ;; Reference: ;; C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat ;; -and- ;; C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\vcvars32.bat ;;; Usage: ;; Place this file somewhere in your `load-path' and add the following line ;; to your `.emacs' file: ;; ;; (load "vcvars32-2010.el") ;;; Code: (setenv "CommonProgramFiles" "C:\\Program Files\\Common Files") (setenv "DevEnvDir" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\") (setenv "Framework35Version" "v3.5") (setenv "FrameworkDir" "C:\\Windows\\Microsoft.NET\\Framework\\") (setenv "FrameworkDIR32" "C:\\Windows\\Microsoft.NET\\Framework\\") (setenv "FrameworkVersion" "v4.0.30319") (setenv "FrameworkVersion32" "v4.0.30319") (setenv "INCLUDE" (concat "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\INCLUDE;" "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include;")) (setenv "LIB" (concat "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\LIB;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\LIB;" "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\lib;")) (setenv "LIBPATH" (concat "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;" "C:\\Windows\\Microsoft.NET\\Framework\\v3.5;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\LIB;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\LIB;")) (setenv "Path" (concat "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VSTSDB\\Deploy;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools;" "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;" "C:\\Windows\\Microsoft.NET\\Framework\\v3.5;" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\VCPackages;" "C:\\Program Files (x86)\\HTML Help Workshop;" "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin\\NETFX 4.0 Tools;" "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\bin;" (getenv "Path"))) (setenv "PROCESSOR_ARCHITECTURE" "AMD64") (setenv "ProgramFiles" "C:\\Program Files") (setenv "VCINSTALLDIR" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\") (setenv "VSINSTALLDIR" "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\") (setenv "WindowsSdkDir" "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\") ;;; vcvars32-2010.el ends here
source share