TFS - Enabling code coverage 'Profile' option in build - c++

I need to perform code coverage as part of the testing of an application within a TFS build, which I run on the Azure web portal, using VSPerfCmd.
If I was to use Visual Studio 2019, I could specify a 'Profile' setting for a specific project within the application solution, which would allow me to instrument the application to perform the coverage via the Visual Studio instrumentation tool (VSInstr.exe). However, the testing needs to be done on a full build done via TFS, not individually via Visual Studio.
I tried to set this in the MSBuild Arguments, but this doesn't work.

Related

All tests are executed although no code changes

In vNext (TFS 2017.3 on prem) I have a build definition which builds a .NET application and run around 3000 tests.
In my Visual Studio Test task I have enabled "Run only impacted tests" to decrease build time. I have done several builds at the same branch (Git) where I know there are no code changes. So my expectation was that the first build would take more time that if the "Run only impacted test" wasn't enabled because it should do extended analysis.
But then in the next build I would assume that no tests were executed as the code haven't changed.
But what is actually happen is that only 14 tests are "Not impacted".
Do you know why?
TIA is presently scoped to the following:
Supported
TFS 2017 Update 1 onwards and on VSTS
Version 2.* of the Visual Studio Test task in the build definition
Build vNext, with multiple VSTest Tasks
VS2015 Update 3 onwards on the build agent
Local and hosted build agents
CI and in PR workflows
Git, GitHub, External Git, TFVC repos
IIS interactions (over REST, SOAP APIs), using HTTP/HTTPS protocols
Automated Tests
Single box topology (tests and application must be running on the
same machine)
Managed code (any .NET Framework application, any .NET Service)
Not yet supported
Multi box topology (where the test is exercising an app deployed to a
different machine)
Data driven tests
Test Adapter-specific parallel test execution
.NET Core
UWP
Please check whether you have a supported scope. More details please refer to the blog below:
https://blogs.msdn.microsoft.com/devops/2017/03/02/accelerated-continuous-testing-with-test-impact-analysis-part-1/

VS2017 not showing Report Viewer in prerequisites

I am trying to deploy a wpf application with an embedded rdlc report using clickonce. The previous version of report viewer (in VS2015) was built-in so it was easy and convenient to use and I had no issues deploying this project.
Now since easy and convenient is not the goal anymore, in vs2017 after a failed deploy with an error message that gave me absolutely no help, I have come to realize that apparently you have to install 2 additional VS extensions and a report viewer runtime on every machine where an app uses and rdlc reports (feels like crystal reports all over again) and you have to exclude the automatically included Chinese localization files in your clickonce deployment (which cause a manifest parse error). Anyway, the instructions on MS website say that click once should have a "Microsoft Visual Studio Report Viewer" prerequisite option to select as requirement of installing your app. However, after installing the runtime on my development machine, restarting visual studio, this option is not available. Does anyone know how to get this to work?
I used Project|Manage NuGet Packages to add this package to my project.
https://www.nuget.org/packages/Microsoft.ReportViewer.Runtime.Common/12.0.2402.15
If you search with Manage NuGet Packages, there's quite a few ReportViewer related items. I'm not sure which ones are appropriate to your WPF app.
Anyway, the deployment project picked up the various ReportViewer assembly dependencies and everything seems to be working without the EXE redist from MS.

How to debug Visual Studio Team Services unit tests

In my team, Visual Studio Team Services (formerly Visual Studio Online / Team Foundation Service) is configured to automatically build the solution and run all the unit tests of the solution, at each check-in.
There is a test that succeeds in my local Visual Studio but not in Team Services: how can i do to have more information about the test that failed? Is it possible to manually run the test in Team Services?
I had the same issue with intermittently failing tests. Visual Studio Team Services says the tests failed, but not why - not on the build's Summary, Log, or Diagnostics tabs, and not when you "Download all logs as zip". However, you can get this information inside Visual Studio.
In Visual Studio, go to the menu View > Team Explorer. Click Builds. You should see a list of recent builds. Double click the failed build. You can now expand the failing tests and see why they failed.

TFS SDK Build Projects

I'm using TFS SDK and I wrote some code which is getting latest version of the selected project from the server. Now that I have the code downloaded I would like to invoke a build of the source locally.
Could you give me tutorial or example code on how to do this with MSBuild?
You can use TFS Team Build Template to do all the activities
Get Latest
Compile Code
Do other activities like running Unit Test, Code Coverage etc..
You can also write custom build activities.
Hope this helps to start

Automated build installer using team foundation service

I have started using the preview of Microsoft Team Foundation Service (TFS in the cloud, henceforth TFService) for a small project, and I'm currently setting up builds using the online build service included with TFService.
What I want to do is to add an installer of some kind. I've previously worked with InstallShield Limited Edition, WIX and Inno Setup and would like to keep using one of those if possible.
I've previously integrated Inno Setup as part of a build process (TFS 2010). This involved installing Inno Setup on the build computer, and adding a custom build task for running an inno setup script. The last part should be possible with TFService as well, because it's possible to create custom build process templates.
However, I realize that installing anything such as Inno Setup or InstallShield will not work with TFService, since it's not possible to install any 3rd party software on the build computer (it's just a cloud service running on some unknown virtual computer which I cannot access).
So my question is; is there a way to automatically create an installer as part of a build process running on TFService? For example, is the build service capable of building installshield projects out of the box (there's a license included with Visual Studio after all)? Or are there other ways to do this?
I have some experience with this trying to get WiX and InstallShield to work with Microsoft TFS Preview cloud service using their managed build agents. On these agents, you don't have administrator rights and you can't install software.
This currently rules out InstallShield which must be installed.
It is however possible to check the WiX binaries into source control and pull them down as part of your build.
WiX uses .wixproj files (MSBuild) to define their project compile activities. This references a targets file and other properties ( referencing registry values ) that won't exist when you deploy this way. A small bit of hacking will get all of these properties to resolve to workable values.
The one problem you may still have though (and I'm thinking TFS managed build environment ) is that you may have to configure your projects to skip MSI ICE validation suites. On the build machines, I played on the windows installer service was outright disabled and this prevented the tests from running.