SonarQube scanner for MSBuild missing CA issues - fxcop

We use SonarQube 5.3 to analyze our C# code.
The analysis is triggered from the vNext build on TFS 2015 (on premise).
We have a quality profile with rules from the C# analyzer plugin (Sxxx) and some FXCop rules (CAxxxx).
We've made a .ruleset that reflects the quality profile to be able to run the code analysis from Visual Studio 2015.
However I'm missing some code analysis warnings/errors in SonarQube that are showing up when running the code analysis locally and also show up in the build log. Both in the MSBuild output that is visible when the build is running on the server, as in the [AssemblyName]CodeAnalysisLog.xml.
The weird thing is, we've been solving a lot of issues lately and we have solved several CA1725 issues that were visible in SonarQube. Now we have a number of CA1725 issues (not suppressed) still visible in the logs and the XML, but they don't show up in SonarQube.

Related

What is the Visual Studio Project setting to prevent an application from launching after a build or rebuild?

I have a home grown project (https://github.com/andybantly/MFC-Fractal) that I have been working on since the Visual Studio 2005/2008 days. I just recently put it in Git. Its home is on CodeProject.
I am not sure when this started (maybe 10 years ago...) but when I migrated my application to the latest version of Visual Studio, new/odd behavior injected itself into the code generation step. The IDE has somehow decided that when I build the source that I really wanted to build and run the source. This is somewhat annoying, especially during a batch rebuild all.
I am looking for helpful suggestions on configuring the IDE to prevent this behavior. It never used to do this out of the box.
Is it a show stopper? Absolutely not. Is it annoying? Depends on the side of bed I woke up on.

TFS Test Agent Configuration Tool for Selenium UI tests

My team has several Selenium Unit Tests that we run locally. Selenium opens a browser and runs through our application. This works fine locally. Now, management wants to run the tests, on demand, via TFS. Should be easy, right? WRONG!
I am having trouble setting up our TFS 2015 server to run these Selenium UI tests.
Everything I read tells me to run the "Test Agent for Visual Studio 2015" tool. Problem is, the tool does not exist on my machine and I cannot understand why. I have tried many things, like installing the MS Visual Studio "Agents", with no luck.
When I try to open the freshly installed "Agents" I get a message saying: "Test Agent for Visual Studio 2015 has no configuration tool".
So the VS.NET "Agents" panel never opens. Seems bizarre to me that I installed something that needs further configuration, with no way to perform that configuration.
From further reading, I think I need to provision a group machine in the TFS web administration page, but am totally unsure if that's required for my situation, as I cannot even get past the basics here.
I see other people have had this problem, with very little response or help from Microsoft. I am a little baffled at why this seems so very difficult to do on a TFS server? It runs locally just fine, like a breeze. But TFS? It's like a giant puzzle.
Once this is working, I need to configure the test agent to run in "interactive mode" so it can run the browser but I cannot even begin to figure that out yet. Where do you set it to "run interactive" because I dont see any of those options. Am I missing TFS installation components? Do I have the wrong Visual Studio? Do I need the Ultimate edition of Visual Studio to be able to perform UI tests with the browser? We have the Professional edition.
Here is someone with the same problem:
https://connect.microsoft.com/VisualStudio/feedback/details/1712725/test-agent-for-visual-studio-2015-has-no-configuration-tool
Does anyone have any ideas or instructions on how to setup the "Test Agent" I need to run my team's existing Selenium UI tests in TFS2015? Seems very difficult when it should not be.
In the link you provided, Allen has explained that "There is no configuration UI with the test agent anymore. This is because we have simplified the existing remote testing scenario by doing the install and configuration for you when running via the build pipeline."
TFS 2015 Update2 now have a "Run Functional Test" task that you can use to run tests (included Coded UI Tests) against machine groups. So, first you have to upgrade your TFS 2015 to TFS 2015 Update2 if you haven't.
The tasks you need for test scenarios using Visual Studio 2015 and Visual Studio Team Services (VSTS) or Team Foundation Server (TFS) 2015:
Create environments from physical or virtual machines that you've already set up.
Set up your build to run your app and tests in the environments that you created.
After your build finishes, review your test results to start resolving problems that you found.
So, your build process template should look like the screenshot below. You need to specify every task to meet the requirement of your project. All TFS tasks can be found at this website, you can get more information for each task from it. Coded UI or Selenium tests that are running on full fidelity browsers would need Interactive Process checked.:

Using FxCop code analysis for .NET 4.5 applications

Is it possible to use FxCop for .NET 4.5 applications?
I am looking to use FxCop with the Visual Studio 2013 Professional edition.
Visual Studio 2013 Professional comes with Static Code Analysis (which is FxCop, just a fancy name for it).
In this link some information is provided:
As a developer, you can run code analysis on your project automatically or you can run it manually.
To run code analysis each time that you build a project, you select Enable Code Analysis on Build (defines CODE_ANALYSIS constant) on the project's Property Page. For more information, see How to: Enable and Disable Automatic Code Analysis for Managed Code.
To run code analysis manually on a project, on the Analyze menu, click Run Code Analysis on ProjectName. For more information, see How to: Enable and Disable Automatic Code Analysis for Managed Code.
This version runs perfectly on .NET 4.5.
FxCop 1.36 is a standalone version of Code Analysis. Microsoft no longer supports or works on the standalone version and currently only working on the integrated version that is included in Visual Studio.
There is a Uservoice going on which asks Microsoft to update the standalone FxCop version. See this link.

Test impact analysis in tfs 2012

I have setup a tfs 2012 server with the build controller and the build agent. I have a simple visual studio 2012 solution with a windows console application project and a test project on a client machine. Test impact analysis is enabled in the build definition.
Simply put, the impacted tests list that should appear on each build performed on the tfs server is never populated. I have tried to change the test runner from vs runner to mstest to no avail.
Please advise. Thanks.
EDIT: I installed VS 2012 on the server. This enabled code coverage, but still no impact analysis.
Fortunately I fixed the 'problem'.
For TIA to work, you need to successfully complete a test case in test manager, passing all test steps. Only then does the analysis file get generated. Also, I had problems with the video recording module of the test controller, which apparently also prevents the file from being generated sometimes, though this could just be a coincidence.
After successfully generating the file, subsequent builds will now have a baseline to compare against.
Have fun.

Is it possible to run an FxCop Code Analysis from the MSBuild command line with VS NOT installed?

Our final build server does not have Visual Studio 2010 installed. It uses the MSBuild.exe from the .NET 4 SDK. As part of our code delivery process to our customer we need to allow him to build the projects from the command line on a Visual Studio 'agnostic' server and also to run Code Analysis rules on that machine.
On the visual studio side we started out with AllRules.rules and created exceptions going foreward so naturally we'd like the exceptions to carry over to the code analysis on the build server.
Is this possible ?
Thanks in advance.
Using standalone FxCop you can customize your CI process as you wish. Open this link and go to "Setting up continuous FxCop code analysis" chapter.
Link above seems to be dead now. You can try to look here on this SO question