I am trying to run this command on the picture within the Jenkins builder
However, i get
"tf' is not recognized as an internal or external command,
operable program or batch file."
tf are commands which work within Visual Studio or through the Visual Studio Command prompt tfpt.exe which is why I was trying to set an environment variable..Oh and I can't use the EnvInject Plugin cuz we just don't use it.
The command should be:
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;%PATH%
You are missing = after SET PATH, further, your newly added path should point to the folder containing TF.exe and not to TF.exe itself.
This command need a VS or Team Explorer installed. Make sure your Jenkins
build agent have one of them installed.
Besides you are lacking of "=" with set path =
Related
I am using VS2019 community and I've set pre-build event:
msbuild "$(ProjectPath)" /t:Clean
I am getting error:
'MSBuild' is not recognized as an internal or external command,
operable program or batch file
How is this possible? Isn't this command supposed to be build into visual studio?
I've checked this and tried to set path environment, but it doesn't help.
Does anybody else has the same problem with this command in VS2019?
Steps that work in my machine:
See this, first we need to make sure MSBuild can be recognized by cmd.exe.
If the command can be recognized by cmd.exe but not build-event from VS, restart the PC can help resolve this issue.
(Something strange is that for my VS still can't recognize it until a restart of the computer)
For VS2019, the correct msbuild path is C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\MSBuild\Current\Bin
And here's another workaround:
Apart from adding the path of msbuild.exe into Environment Path and call it in pre-build event, you can also consider using MSBuild Task.
Add script below into xx.csproj:(work for .net framework...)
<Target Name="MyCleanBeforeBuild" BeforeTargets="BeforeBuild">
<MSBuild Projects="$(ProjectPath)" Targets="clean"/>
<!--<Message Text="Custom Clean" Importance="high"/>-->
</Target>
With latest update to VS2019 - version 16.3.4 - the error is no longer there.
Using "dotnet" instead of "msbuild" could work if you got that installed.
So, in my case, instead of running "msbuild /t:restore" I figured I can use "dotnet build" and have the same result.
Here's the documentation in case you want to see more equivalent commands.
https://learn.microsoft.com/en-us/dotnet/core/tools/
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.
I want to create a batch file for building releases of a multi-solution software. What I am curious about how may I obtain the exact MSBuild command that Visual Studio executes when I click on "Rebuild Solution"?
It is equivalent to
MsBuild /t:Rebuild /p:Configuration=<config>;Platform=<platform>
although VS actually generates a temporary msbuild file from the solution and then builds that. You get the file by setting an MSBuildEmitSolution environment variable:
open a VS command window
enter set MSBuildEmitSolution=1
enter devenv to open a VS instance within that command window so it uses the MSBuildEmitSolution environment variable
open and build your solution
I am trying to use this tutorial from MS to verify I can build a .cpp file from the command line on my system. I seem to be having problems with my VS Command Prompt. It cannot find cl.exe or the needed include files. I added C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin and C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE to my path so it would find cl.exe. Now my error is:
test.cpp(1) : fatal error C1034: iostream: no include path set
Isn't the whole point of the VS Command Prompt to setup all these environment vars for me? Why isn't it setting it up properly?
I'm not sure exactly what your problem is but you might want to do the following to help determine the actual cause.
You may have noticed that the VS command prompt shortcut is a bat file. The first line is
#echo off
Change it to
REM #echo off
Run it again and see if you get any errors. If you don't it may be in one of the processor specific batch files to know which one that is look for the call to other batch like this.
C:\Program Files\Microsoft Visual Studio 10.0\VC>call "C:\Program Files\Microsof
t Visual Studio 10.0\VC\bin\vcvars32.bat"
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Again REM out the #echo off in the batch and then run it again and see what errors you get.
Update from comment
The error ERROR: Cannot determine the location of the VS Common Tools folder
means your missing the Environment Variable %VS100COMNTOOLS% which is usually set to
"c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\"
You can simply add it back using system properties -> Advanced -> New (under system variables)
See this superuser question for more on environment variables
I just figured it out. Thanks to Conrad Frix for the debugging tip.
It is surely due to some lovely security policy I have here on my workstation. Running the shortcut as administrator works. My account is a local admin account, but the admins do all kinds of weird stuff to our machines here...sigh. So, much of our development has to happen by "elevating".
Note, I was able to change the shortcut to run as under administrative privileges by selecting Properties->Advanced->Run as administrator.
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.