How do I setup environment variable INCLUDE for Visual Studio 2005? - visual-studio-2005

Is there a script that I can run that will setup my %INCLUDE% environment variable?
I'm running PC-lint and it can't find my include header files. I went through the documentation and it appears that I need to setup the %INCLUDE% environment variable.
I was wondering if there's an easy way to do it.

Visual Studio comes with a VCVARS32 (it might be renamed by now) batch file in its directory that will set all of these environment variables for you, and give you a shell with them set. It has a start menu entry, if you installed normally -- or maybe it came with the Platform SDK? It's been a while.
From the Microsoft documentation on the subject:
To run vcvars32.bat
At the command prompt, change to the \bin subdirectory of your Visual C++ installation.
Run vcvars32.bat by typing VCVARS32.
Barring that, you can permanently set your environment variables (per-system or per-user) in Control Panel, under System.

Related

How to add batch file in windows environment variable

I am following the installation guide for openvino on Windows. After a successful installation, we need to run setupvars.bat file in order to initialize the openvino environment. We can also add it permanently in environment variable so that it is initialized automatically. But the instructions are not given on how to add it.
I wanted to know if its possible to add the setupvars.bat so the it runs automatically. Also I need to run the visual studio from the same environment.
I always do this step manually which takes a lot time. I first open a cmd, navigate to the desired folder and then run setupvars.bat. After that from the same cmd, I navigate to the visual studio installed directory and then start the visual studio from the cmd so that visual studio is launched under same openvino environment. Is is possible to automate all this task. Thanks
Solution 1: You can set the environment variables for the visual studio as mentioned here - How do I set specific environment variables when debugging in Visual Studio?
Solution 2: Write one more batch file which will 1st call setupvars.bat & then open the visual studio. Then you can run the new bat file.
Solution 3: You can create a cmd shortcut like this - Run a Command Prompt command from Desktop Shortcut
In this, you can 1st call setupvars.bat and then cmd to open Visual Studio. Once you click the new shortcut both the things should happen automatically. You can even add this step along with the installer.

Access ProgramFilesFolder from Visual Studio post-build events

When building a C# project in Visual Studio, in the post-build events I need to call a program that is situated in C:\Program Files\\MyProgram.exe. How can I access the "C:\Program Files" folder from the post-build events?
At this link: http://msdn.microsoft.com/en-us/library/42x5kfw4.aspx there are several Macros that can be used in the post-build events section of Visual Studio. Is there a Macro or is there a way to access the default ProgramFilesFolder path?
Don't look for a macro, none is provided since you can also use environment variables in the pre/post-build steps. Just like you can with a .bat file, which is the way these build steps actually execute. You are probably looking for the %programfiles% environment variable. So to run that program, simply use:
"%programfiles%\myprogram.exe"
Sadly, using %programfiles% leads to the x86 program files folder. There's an environment variable for x86 program files folder (%programfiles(x86)%) but none for the x64 folder. Thus, you can't target the x64 program files folder, neither explicitly nor implicitly, when using standard environment variables. You'll always target the x86 folder. (vs2019 professional 16.10.1)

Batch Builds in Visual Studio 6 for VC++ project

In VS 2008 and VS 2010, one can easily create a solution and modify the "Solution Configuration". We can choose what configuration each project gets built in when we trigger a build at the solution level.
Is such a facility available in the Visual Studio 6.0?
In my experience:
when a configuration is chosen (form the list available) in VS6 for a VC++ project, the dependencies (which themselves have multiple configurations defined) get built in some random order. There is no way to control the configurations of dependencies at build time.
"Batch Build" does come close to this but is not as flexible for my purpose.
I have tried various options in the VS6.
Hope I am clear.
Here is a link on the MSDEV command line.
https://msdn.microsoft.com/en-us/library/aa699274(v=vs.60).aspx
There is a way to control the building of dependencies. Specify /NORECURSE and dependencies will not be built.
I use /REBUILD with /NORECURSE to keep the dependencies from getting built.
And I build each project one at a time inside the workspace in a bat file by doing a chdir to the subdirectory and calling MSDEV just for that subproject:
msdev myproject.dsp /MAKE "myproject - Win32 Debug" /REBUILD /NORECURSE > Build.log
Then I cd to the next project directory one at a time.
On a side note, I had difficulties for several years where NMAKE would not work for my specific tasks. Turns out that the PATH environment variable inside MSDEV (Visual Studio 6.0) is different from the PATH environment variable of a command shell you would run NMAKE on.
The Path used by the MSDEV shell is the %PATH% at the time Visual Studio 6 was installed. We use this and poke the registry as needed for MSDEV to get the correct path setup when switching revisions of our software; however this doesn't help update the %PATH%. The MSDEV path can be queried with a query script. I don't have my example handy.
That is why builds in MSDEV sometimes work when builds using the command line don't, as the path to DLLs differ, and any custom build steps that run .exe will not work outside of the MSDEV environment unless the path is updated.
I have a script somewhere that reads the queries the registry to extract the MSDEV path and update PATH of a shell so that batch scripts doing nmake will work as they would inside the MSDEV shell environment. The problem with the REGISTRY QUERY is that the return arguments differ with different flavors of Windows (XP/SERVER2003/...).
One thing I just discovered is that Incredibuild works with the old VS6.0 MSDEV IDE. This is a game changer. It distributes builds. I'm evaluating it now, but it might be useful to anyone waiting for long VS6.0 builds.

Env vars for Visual Studio command prompt

I'm doing an RDP into a machine that has just the CLR installed, and doesn't have Visual Studio on it. Can I somehow load all the Visual Studio-specific environment variables on to the regular command prompt and convert it into the VS command prompt so that I'm able to build my projects via command line?
I looked at the vcvarsall.bat file. That calls the appropriate processor-specific batch file. Couldn't get any inputs from there.
Short of installing all VS, or tracing thru all the various batch files to find out what's getting set, you may be able to simply capture the env vars that are set.
Open up a VS command prompt, and run set > vars.bat
Then open up vars.bat, and put a set command in front of each line.
Not sure how much this will help, since you're going to be missing all the utilities that come with Visual Studio, but it does answer your question.
I don't recommend trying to copy only what you need. You'll need other header files, libraries, dlls, etc... You can instead install VS express edition.
If you are trying to debug a problem you can use remote debugging in Visual Studio or use WinDbg on the computer.

How to get Program Files Path in Visual Studio configuration

I followed this tutorial to make NUnit tests debugable in Visual Studio. In the debugging options I set "Start external program:" to C:\Program Files\NUnit 2.4.8\bin\nunit-x86.exe.
Is there a way to get the program files directory dynamically to avoid problems when other people work with this solution on their system?
The environment variable $PROGRAMFILES holds this. Most properties in visual studio allow you to use environment variable expansion like this: "$(PROGRAMFILES)\NUnit 2.4.8\"
%ProgamFiles% if using in a Windows path.

Resources