I have a project in Visual Studio 2013 which is setup to copy resource files into proj.win32/Debug.win32 directory (this is the debug build directory). The copying is being done during Pre-Link Event with the following command:
xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
My question is can I do this copying on each run of the project in spite of compilation or linking is being done. (I need this to be able to modify my resources and check on each run if I lake the new parameters).
Related
We have set the parallel execution count to 1 so that all the projects will build one after other.In the Visual Studio settings.
With below command from Devenv.exe we are able to compile the solution correctly.
call vcvarsall.bat x86_amd64
devenv /Build "Release|x64" "w:/Frameworks/Frameworks.sln"
But with MSBuild, with below command, the solution is failing to compile, when I cross check the log, the order of compilation of projects is not correct, not taking from solution file.
call vcvarsall.bat x86_amd64
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "W:\Frameworks\Frameworks.sln" /t:build /fl /flp:logfile=Frameworks.log;verbosity=normal /p:Configuration=Release;Platform=x64 /m:1
Any suggestion, how to fix set msbuild to compile only from order mentioned in solution file.
Open your solution in VisualStudio, on the solution explorer right click the solution name and look for "Project Dependencies..." and/or "Project Build Order..."
The UI is self explanatory, so configure as required, save all and try the MsBuild command again.
Okay, I am going nuts here. I have searched and tried every command I can find to try to copy the result of my build to another directory on the network. So basically I want to build the project, then have the created .DLL copied and overwrite the one on the network. Here is my latest try that I found online:
xcopy /i /e /s /y /f $(TargetPath) "\\SERVER\Folder1\Folder2\Binaries"
This just does not seem to work! Can somebody give me an example of how I can write this line that will work?
I have a VC project file that I'm building from command line using MSBuild. I want to specify the /MP flag without editing the project file. Is that possible?
I've tried set CL=/MP prior to calling MSBuild, but it has no effect.
This can be accomplished by accessing the CL_MPCount Visual Studio option:
MSBuild /m:2 /p:CL_MPCount=2 /p:Configuration=Release tf_tutorials_example_trainer.vcxproj
The above instructs the compiler to perform a maximum of 2 parallel compilation tasks. The /m:2 flag allows MSBuild to build two projects in parallel. The net result is that we have a maximum of 4 cl.exe processes running in parallel.
UPDATE: The CL_MPCount=2 flag gets passed on to cl.exe as /MP2. This allows parallel compilation of 2 .cpp files within the same project.
You need a property that you can override from the command line. Open the .vcxproj file in a text editor, Notepad will do. Locate the "Globals" property group and add a property named, say, "Turbo"
<PropertyGroup Label="Globals">
<Turbo>false</Turbo>
...etc...
</PropertyGroup>
And use the property to specify the compile option. Since it can only work in the Release build:
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<MultiProcessorCompilation>$(Turbo)</MultiProcessorCompilation>
...etc...
</ClCompile>
And run MSBuild:
msbuild /p:Configuration=Release /p:Turbo=true
Does anyone know how to use the command line compiler ('cl' and 'link') in Visual C++ to build a project? We are more used to 'make' and 'gcc' here, but were recently moved to Visual Studio. I suppose we could use nmake, but I'm hoping for some information regarding using 'cl' and 'link' (as in compiling without a .sln file).
something along the lines of
create object files
link object files to create executable
is what we want, but I just can't seem to make it work using the command line parameters. Help please?
As I tend to always say, anything Microsoft related can be found on MSDN and a quick trip to google.
cl.exe is documented here: http://msdn.microsoft.com/en-us/library/ms235639%28v=vs.100%29.aspx
It's pretty simple just enter the directory of cl.exe and write in the cmd.
cl.exe /? and then it will list all the available flags.
You need to get 2 Files in you Path:
vcvarsall.bat
cl.exe
vcvarsall.bat is a shellscript which is responsible to determine on which architecture you're running on and includes several folders into your path which the cl compiler needs. on my pc this script resides under C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
cl.exe is the compiler itself and on my pc resides under C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
i simply declared a environment variable VC_HOME : C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC and included in the Path %VC_HOME%;%VC_HOME%\bin;
now when you open the shell, at first run vcvarsall.bat and then you can say: cl MyProgramm.cpp
Edit: sorry, didn't notice the 'without .sln' part. Ignore this answer please. I'm leaving it in place for others that may actually need this but it's not an answer to the original question.
If you just want to build a solution/project file (that is, most of your build settings are already defined in your project file), you can use devenv.exe to build the solution/project for you - this is probably the simplest way of doing a build from the command line.
For example:
devenv.exe myapp.sln /Rebuild "Release|x64"
cleans & builds the myapp.sln solution in the Release|x64 configuration.
If you run
devenv.exe /?
command, it gives you all command-line options. You can use devenv to build only a specific project in the solution by using the `/project' switch.
If you need more flexibility (and you're willing to spend a lot of time writing the right script), you can use nmake to build from the command-line, but I don't know that well, so I can't give useful advice.
I'd like to build all the configurations of a VS 2008 C++ project on the command line. Something like:
devenv TheProject.vcproj /build /nologo
But this doesn't work because the /build command insists on having a configuration following it like this:
devenv TheProject.vcproj /build "Release|Win32" /nologo
Is there a way to get a command line build of all configurations within the vcproj file?
I was thinking you can do what you want with MSBUILD, but it appears that it isn't much better for this than DEVENV.
You still have to specify each configuration on the command line, although it would be easy to write a batch file to accomplish this with either MSBUILD or DEVENV.
It looks like previous versions of the development environment may have supported an "ALL" option, but VS 2008 does not.
http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/8701b3d0-d5c9-45fb-8dd4-e7700c8caca6/
Not directly, but you can have projects depend on other projects - so you could have an 'all' or 'install' project with a dependacy of everything else.
Haven't used VS in a long time. But the project properties panel used to show the command line generated for linking and compiling a project for a particular configuration. It used to be under the Advanced tab. Will using that directly from the command line serve your purpose? This method will not use the VS IDE at all.
Alternatively,
Steps:
Create a project which has a dependency on all other projects.
Write a script which builds this project with different configurations sequentially. You cannot create a single configuration which encapsulates all other configurations.