I have class library project which reads word document files. and I have created 30 unit cases scenarios for it. When I run the unit test using visual studio IDE it runs perfectly and all the test cases get "Success", However when I use Visual Studio Command Prompt and test it, some of the test cases get failed. I would appreciate if you guys can provide me some hint in this regard.
To test my solution in Command Prompts I type: "MSTest /testcontainer:mysolutiontest.dll"
If you are running VS2012 or later, use vstest.console.exe:
"C:\Program Files (x86)\Microsoft Visual Studio
12.0\Common7\ide\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
PathToYour.dll /logger:trx
You'll also probably want to use a .runsettings file to specify the TargetPlatform and ResultsDirectory, which would then use a command line like this:
"C:\Program Files (x86)\Microsoft Visual Studio
12.0\Common7\ide\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
PathToYour.dll /logger:trx
/settings:PathToYour.runsettings
Related
I just want to change the exe file Visual Studio compilation path change
I am doing it like this now. i created a bat file that copied file. I have added visual studio build events. I wonder if there is an easier way.
meanwhile the exe file is being copied to the network drive
I had this problem in a different context (Elixir/Phoenix, Rust), but the root cause was the same: cl.exe could not be found during compilation.
My setup was:
Windows 10, x64
Visual Studio Community 2017 already installed, but only for C# development
For some reason the solution with installing the Visual C++ Build Tools (as #cozzamara suggested) did not work. Stops during installation with some obscure error message. Guess it did not liked my existing Visual Studio installation.
This is how I solved it:
Start up the Visual Studio Installer
Check the Desktop development with C++ (screenshots here)
Execute following command before compiling:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
From this on the command cl.exe works. Alternatively (and more conveniently for development) start the application 'Developer Command Prompt for VS 2017' or 'x64 Native Tools Command Prompt VS 2017'.
Share
I solved the problem by writing code like this in the Post build field, I just ensured that the exe was copied to the field I wanted
COPY $(TargetPath) "\x.x.x.x\ortak\yakup\TestApp.exe"
pause
$(TargetPath) = It gives the location where the exe exited, along with the exe name
"C:\yakup\project\TestApp.exe" like
I want to just build, and output the logs.
Following the doc,
The following command-line switches don't display the IDE.
start "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\devenv.exe" "C:\code\EPMD\Kodex\Solutions\Kodex.All.sln" /Rebuild
This does open the IDE.
Using
start "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" "C:\code\EPMD\Kodex\Solutions\Kodex.All.sln" /t:Rebuild /p:Configuration=Release
also opens the IDE and builds the solution.
Doing
start "" /WAIT "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe" /build Release Kodex.All.sln
doesn't compile anything (that I know of), and returns immediately, silently.
Obviously I am missing some space or options or other trivial detail.
Don't even know how to debug this.
Help please
You can use the examples provided in the below Microsoft Docs link:
https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe?view=vs-2019
Check the See Also section documentation as well. Hope this one helps!
I'm running the following:
D:\GitRecompile>"c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" MyFolder\MyApp.sln /build "Debug"
It gives no error, no results, nothing. Almost like I just hit enter from the command line.
I'm trying to do a batch rebuild of several BizTalk Projects from the command line to make sure all code was checked-in corretly.
I also tried:
D:\GitRecompile>c:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild MyFolder\MyApp.sln /p:Configuration=Debug
It ran, but got a lot of errors, such as xxx.xsd.cs could not be found. BizTalk creates the .cs from the .xsd at build time; so it seems like the build should have created those files.
I would like to leverage visual studio code coverage ability out side Visual Studio as diagnostic test on environment without a Visual Studio instance on it.
I could not grab a tutorial or guideline on how it is done.
So how it can be done?
Even guidelines are good.
In Visual Studio 2012 or newer you can use the vstest.console.exe to invoke tests to gather code coverage. the /enableCodeCoverage commandline switch enables it.
You can gather coverage from a commandline using the older vsperfcmd tool as well. This requires you to have at least a Visual Studio Test Agent installed on the machine. This is no full Visual Studio installation, but it contains teh components required to run tests and gather coverage details.
How to setup the VsPerfCmd tool can be found here in this MSDN post. I copied the steps:
I assume you want code coverage on MyApp.exe
Open Visual studio command prompt
Add %ProgramFiles%\Microsoft Visual Studio 10\Team Tools\Performance Tools to the path
set path=%path%;'%ProgramFiles%\Microsoft Visual Studio 10\Team Tools\Performance Tools'
CD to the folder that contains MyApp.exe
Instrument MyApp.exe for coverage:
vsinstr -coverage MyApp.exe
Start the coverage monitor to collect code coverage data:
vsperfcmd -start:coverage -output:MyApp.coverage
Run the instrumented MyApp.exe:
MyApp.exe
Shut down the monitor once MyApp.exe is done:
vsperfcmd -shutdown
Open the MyApp.coverage file in Visual Studio
With the Test Agent installed on the machine, you can also trigger a test run from Visual Studio (even if it is installed on a different machine).
We use Jenkins to build our solutions automatically. We call devenv (Visual Studio 2010) by a command line: devenv PathToProject\Project.sln /build Release
When the solution contains a defective project (*.vdproj, *.csproj), opening the solution in the Visual Studio IDE will result in an error message. But when building the solution with the above command line, no error message is shown at all, and consequently Jenkins reports success.
if you want to reproduce the problem, just open the vdproj file in an editor, and remove a } somewhere in the file.
How can that problem be solved?
On Visual Studio 2012, /Out writes the build messages to a text file.
devenv.exe YourVisualStudioSolution.sln /build "Debug|Win32" /Out "YourLogFile.txt"
According to MSDN, this switch should work on Visual Studio 2010 as well.