Batch Builds in Visual Studio 6 for VC++ project - visual-studio

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.

Related

How to execute VS2013 MSBuild from an EXISTING command prompt

I would like to "MSBuild" (VS2013) my application as part of a bigger ".cmd" script. I cannot let visual studio build a shell and issue commands into that shell (please don't ask why; if that were negotiable I wouldn't have to ask this question in the first place)
I have the shell, its path, and its environment variables prepared for everything else (except Visual Studio 2013 and MSBuild). What can I do or invoke, so that the next command then can be "MSBuild..."
I have spent hours searching in vain but all I have found looks to me like it requires building a new shell, applying a mouse click, or loosing the standard input.
Thanks
Run vsvars32.bat. It is in the Common7\Tools folder of your Visual Studio installation. In the case of VS 2013, this folder is available in the environment variable, VS120COMNTOOLS. It is similar for other versions of VS. Your script will be something like:
call "%VS120COMNTOOLS%vsvars32.bat"
msbuild mysolution.sln /t:Build

Visual Studios 2010 the program can't start because opencv_core243.dll is missing

I am learning how to use OpenCV and as practice I ran a program (in Release mode, x64). I had 0 compiler errors but got a pop-up screen that said:
"the program can't start because opencv_core243.dll is missing"
However, I made sure I declared the correct environment variables and specified the necessary libraries/directories. My problem was fixed when I copied the following .dll files into x64/Release:
opencv_core243.dll
opencv_highgui243.dll
opencv_imgproc243.dll
My program compiles fine now and works. However, I would like to know why. It feels cheap to copy and paste these .dll files. Did I miss a step where these .dll files would be generated automatically?
The actual solution for this problem is to append the path of opencv bin directory to the System PATH environment variable.
Have a look at this answer describing the complete procedure to install OpenCV in Visual Studio 2010.
There is a disadvantage of this approach. The prebuilt OpenCV x86 and x64 binaries have same names. So by appending the path of OpenCV to the PATH variable, you can execute either the 32 bit version or the 64 bit version at a time. To run the other version, you have to change the PATH variable.
An alternative to this, (my personal favorite) also involves copying the dlls to output directory, but this is done automatically at the end of compilation. What I do, is to create new environment variables for x86 and x64 dll paths. I create the User Variables CV_BIN32 and CV_BIN64 containing the paths of x86 and x64 dlls respectively.
After creating the User Variables, open your OpenCV project, go to Project Properties -> Build Events -> Post-Build Event -> Command Line.
Add the copy commands for the dlls you require at the runtime.
This one is for Win32 Release Configuration:
copy "$(CV_BIN32)\opencv_core243.dll" "$(OutDir)"
copy "$(CV_BIN32)\opencv_highgui243.dll" "$(OutDir)"
You can change them for all the 4 configurations, (Debug/Release),(Win32/x64)
Now when the project build procedure completes, the specified dlls will be copied to the output directory automatically, and the error will not be shown.

Build from command line in Codegear 2009 IDE

Is it possible to automagically generate a MAKEFILE from the Codegear 2009 IDE? Or build a project from the command line?
No, but depending on your objective, you may be able to do what you want. If you simply want to do a build from a command line, this is possible. Because CB2009 uses msbuild, you can drive a build which uses all the same options and settings as an IDE build. There is a rsvars.bat file which sets all the environment variables you need and a shortcut to this batch file installed in the start menu called "RAD Studio Command Prompt" Once those are set, you can then call:
msbuild yourProjectFile.cbproj
This can then be integrated into a make system, continuous integration tool, or other automation.

Under vs10 msbuild.exe how can a specific project within a solution.sln be Ignored?

Under vs10 msbuild.exe how can a specific project within a solution.sln be Ignored?
I am building a large project that is moving to Visual Studio 10.0. In the IDE I can uncheck a project within the configuration manager and it will not build it. I need to mimic that behavior with a command line call to msbuild.exe.
The project I want to bypass is an *.dll plugin with a link error. I am stuck on stupid with the link error at the moment and since it stands alone, I can run the main program with out it and just live with a warning at run time that it isn't present.
I need some switch magic concerning calls to msbuild.exe.
If you have a certain configuration in the sln (configured in VS Configuration Manager) that you want to build with MSBuild, you can do so with the following command line:
msbuild /p:Configuration=MyConfiguration MySolution.sln

Custom Build Step Paths Between x86 and x64 in Visual Studio

For reference, I'm using Visual Studio 2010.
I have a custom build step defined as follows:
if exist "$(TargetDir)"server.dll copy "$(TargetDir)"server.dll "c:\program files (x86)\myapp\server.dll"
This works great on my desktop, which is running 64-bit Windows. However, when I build on my laptop, c:\Program Files (x86)\ doesn't exist because it's running 32-bit Windows. I'd like to put in something that will work between both editions of Windows, since the project files are under version control and it's a real pain to change the paths every time I work on my laptop.
If this were a *nix environment I'd just create a symlink and be done with it. Any ideas?
You can put this in your project file:
<PropertyGroup>
<ProgramFiles32 Condition="Exists('$(PROGRAMFILES) (x86)')">$(PROGRAMFILES) (x86)</ProgramFiles32>
<ProgramFiles32 Condition="$(ProgramFiles32) == ''">$(PROGRAMFILES)</ProgramFiles32>
</PropertyGroup>
And then you can use $(ProgramFiles32) in your post build event.
For more information check this stackoverflow question.

Resources