MSTest.exe not working - visual-studio-2013

In Windows sever where VS2013 not installed, i tried to run MsTest.exe.
MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\6\Nerddinner\myjantest2\Sources\Nerddinner_3.0\CodeCoverage.testrunconfig" /searchpathroot:"C:\Builds\6\Nerddinner\myjantest2\Binaries" /resultsfileroot:"C:\Builds\6\Nerddinner\myjantest2\TestResults" /testcontainer:"C:\Builds\6\Nerddinner\myjantest2\Binaries\NerdDinner.Tests.dll"
Im getting the output. When i tried to publish the report, Im facing below mentioned error.
MSTest:
MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\6\Nerddinner\myjantest2\Sources\Nerddinner_3.0\CodeCoverage.testrunconfig" /searchpathroot:"C:\Builds\6\Nerddinner\myjantest2\Binaries" /resultsfileroot:"C:\Builds\6\Nerddinner\myjantest2\TestResults" /testcontainer:"C:\Builds\6\Nerddinner\myjantest2\Binaries\NerdDinner.Tests.dll" /publish:"http://pheonixdevops01:8080/tfs/defaultcollection" /noprompt /publishbuild:"vstfs:///Build/Build/2267" /teamproject:"Nerddinner" /platform:"Any CPU" /flavor:"Web.Debug"
Error:
Invalid switch "/publish".
Invalid switch "/publishbuild".
Invalid switch "/teamproject".
Invalid switch "/platform".
Invalid switch "/flavor".
For switch syntax, type "MSTest /help"
Team Explorer 2013 also installed. I'm trying to run MSTEst in the windows server where VS2013 is not installed.

Microsoft recommends running the tests in VSTest.Console in later versions than Visual Studio 2010. MSTest is still available for backwards compatibility with older versions in Visual Studio 2012 and 2013. So Maybe You can try Running the same in VSTest
Also there are some errors in your commands like extra quotes:
/publish:http://pheonixdevops01:8080/tfs/defaultcollection
/publishbuild:vstfs:///Build/Build/2267
Try Reading:https://msdn.microsoft.com/en-in/library/ms182489(v=vs.120).aspx

Related

Calling vcvarsall.bat gives "Windows cannot find powershell.exe" on Windows 7 / VS 2019 Build tools

I previously had Visual Studio 2015 (14.0) Build tools installed, and I could build a simple C++ program, without any IDE, with:
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
cl helloworld1.cpp
Now that I installed Visual Studio 2019 Build Tools, calling vcvarsall.bat gives this message:
Windows cannot find 'powershell.exe'
but after closing the dialog, it still continues (!). But then it fails with:
cl : Command line error D8027 : cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\c1xx.dll'
I don't see why powershell would be mandatory to just set a few environments variables and set up everything to use cl.exe.
Question: what's the proper way to call cl.exe with VS Build Tools 2019?
Shouldn't we call vcvarsall.bat first, like with previous versions?
(important: I'm looking for a 100% terminal mode, no IDE)
The official way would be to to add %SystemRoot%\System32\WindowsPowerShell\v1.0 to your PATH either permanently or just before calling vcvarsall.bat.
An alternative is to do a set VSCMD_SKIP_SENDTELEMETRY=1 before calling vcvarsall.bat. This works because vcvarsall internally calls vsdevcmd, which in turn uses powershell to configure "send telemetry if user's VS is opted-in". However, the telemetry step is bypassed when VSCMD_SKIP_SENDTELEMETRY is defined (though this appears to be undocumented, and thus subject to change in future versions), then powershell is no longer used or required.

Visual Studio 2015 - Clang version not found when building from command line

I have a Xamarin-based solution in Visual Studio 2015. One of the projects is an Android native shared library containing C++ code.
When I build the solution from within VS 2015 IDE, everything works as expected. However, when I try to build the solution from the command line I get an error.
The build command is:
msbuild mytest.sln /p:Configuration=Release /p:Platform=ARM /t:Rebuild
The error I get is:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Clang_3_8 (Platform Toolset = 'Clang_3_8') cannot be found. To build using the Clang_3_8 build tools, please install Clang_3_8 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...".
My Visual Studio 2015 has all the updates applied. Wondering if anyone knows what the problem could be. Is it a path problem? Regards.
Turned out it is a path problem. Make sure to use the developer command prompt link under Program Files-->Visual Studio 2015->Visual Studio Tools. This batch file sets up proper paths, including the one for clang.

Visual Studio 2005: "Error: the Visual C++ Project Engine is not properly installed."

My VS2005 started printing the following error:
Error: the Visual C++ Project Engine is not properly installed. The build cannot continue. Please repair the Visual Studio installation.
What do I do now? Is there a way to fix this that does not require reinstalling the application?
I was able to solve this by following this procedure:
locate this file "VCProjectEngine.dll" (vc/vcpackages)
re-register it by running this command on the shell ( the command window):
regsvr32 VCProjectEngine.dll

Error when running unit tests from MSBuild

I have an MS Build script that runs on the build server and then runs unit tests (have runtests set to true).
I am getting the following errors when calling MSTest. Some people suggested installing Visual Studio 2010 Test Edition and Team Explorer 2010. After doing that am still getting the same errors. Seems I need a specific version of MSTest to be able to publish to TFS.
Any ideas?
===========================================================
The "TestToolsTask" task is using "MSTest.exe" from "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe".
Invalid switch "/publish".
Invalid switch "/publishbuild".
Invalid switch "/teamproject".
Invalid switch "/platform".
Invalid switch "/flavor".
For switch syntax, type "MSTest /help"
MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.
===========================================================
Try installing VS2010 Premium or Ultimate, these include a version of MSTest that supports the switches for publishing test results. See also Running VS2012 unit tests or Running VS2010 unit tests.

MsTest fails when running unit tests as part of CI using TFS 2008

My configuration:
VS2010 solution
TFS 2008
Build server - TFS 2008
Build server also has VS2008 Team Suite and VS2010 ultimate installed
TFS 2008 builds my VS2010 solution properly. But when it comes time to run the unit tests I get the following MsTest error.
Using "TestToolsTask" task from
assembly "D:\Program Files\Microsoft
Visual Studio
9.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll".
Task "TestToolsTask" Command:
d:\Program Files\Microsoft Visual
Studio 10.0\Common7\IDE\MSTest.exe
/nologo
/searchpathroot:"D:\Builds\App\Source\86\Binaries"
/resultsfileroot:"D:\Builds\App\Source\86\TestResults"
/testcontainer:"D:\Builds\App\Source\86\Binaries\\Tests.dll"
/publish:"http://tfsServer:8080/"
/publishbuild:"vstfs:///Build/Build/26029"
/teamproject:"Proposal" The
"TestToolsTask" task is using
"MSTest.exe" from "d:\Program
Files\Microsoft Visual Studio
10.0\Common7\IDE\MSTest.exe". No platform specified for publish
operation. For switch syntax, type
"MSTest /help"
MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.
[D:\Builds\App\Source\86\BuildType\TFSBuild.proj]
The previous error was converted to a
warning because the task was called
with ContinueOnError=true. Build
continuing because "ContinueOnError"
on the task "TestToolsTask" is set to
"true". Done executing task
"TestToolsTask" -- FAILED.
I am not sure what is causing MsTest to fail.
Things tried:
- Provided write access to the build folder to the service account that builds the source on the build machine
You can execute a VS2010 build from within TFS2008's MSBuild, but it looks as if it's using Visual Studio 9.0 TestToolsTask (2008) to try to run a Visual Studio 10.0 (2010) test project (MSTest.exe). I'd try tweaking MSBuild to run the TestToolsTask from the "Microsoft Visual Studio 10.0" folder rather than "9.0", so that the entire process is using the same version of the tools. You can override the tools paths in your tfsbuild.proj file's Properties to ensure the correct version of Visual Studio is used to build with - something similar may apply to the test tools.
Alternatively, it's running the VS2010 test tools correctly, but still trying to use a command line that is specific to 2008 - check the settings and see if you can tweak the command line (you may need to override the MS targets files that is running the build if it's a 2008 version). For example in TFS 2010, a lot of command lines changed from using a simple "server:MyServer" to something like "collection:http://MyServer:8080/tfs/MyCollection". You may therefore have to alter the command line to gain full compatibility with the 2010 version of the tool that is now running, even if it still ultimately points at a 2008 server.
My third suggestion (which isn't necessarily very helpful) is to just upgrade to TFS2010 - it's typically a painless install, vastly better than 2008, and will eliminate any difficulties caused by using a hybrid 2008/2010 setup. (If it helps, I was reluctant to upgrade to 2010 because the 2005->2008 upgrade was 8 days of sheer hell. But in comparison the core of the upgrade to 2010 only took a few hours and "just worked" - the install/upgrade process is much improved)
Jason had the correct idea that lead me down to the correct solution.
In my case, I had to update the "Microsoft.TeamFoundation.Build.targets" to point to "Microsoft.TeamFoundation.Build.ProcessComponents.dll" (VS2010 dll) instead of "Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll" (VS2008 dll)
I also had to make sure that the PlatformToBuild was specified in the TfsBuild.proj file.
Once these 2 steps were done, UnitTests were being run as part of the CI build using TFS2008 and a VS2010 solution.
I have blogged about the solution in detail here: http://blog.aggregatedintelligence.com/2011/03/vs2010-tfs-2008-and-unit-tests.html

Resources