Prevent Code Analysis from testing Provider Hosted Apps

125 views Asked by At

I am on a SharePoint project that has a dozen or so Provider Hosted Applications.

For those not familiar, PHA's are basically fancy MVC web apps but they have a secondary "special" project that gets added to the solution that contains an app manifest used by SharePoint (sort of reminiscent of old VDPROJ project types). This special project type is only used when packaging the application for consumption by SharePoint, it serves no other purpose and therefore has no need for generating output such as DLL's or EXE's (except for when creating a deployment package, but that is irrelevant to this conversation).

The problem I am having is Visual Studio fails when running Code Analysis on all the PHA's because the PHA's app project does not generate a DLL. The analysis isn't running and reporting errors, it has a hard failure because it is expecting the special app project to generate a DLL and that DLL is physically not found. This prevents Code Analysis from even getting to the point of checking if the checkbox for "Enable Code Analysis on Build" is checked or not (which it isn't in case you're wondering). The only thing I get is two error messages like this person on CodePlex was having:

CA0052  Error Running Code Analysis CA0052: No targets were selected.   [Errors and Warnings]   (Global)     
CA0055  Error Running Code Analysis CA0055 : * Could not load file: 'bin\Debug\xxxxx.dll'.  [Errors and Warnings]   (Global)

I have even gone to the point of creating a brand new PHA project from scratch using the Visual Studio 2013 wizard leaving everything as default which should eliminate any potential for hard external references the existing projects might have. Even then I still run into the same problem. Every time Code Analysis is run Studio tries to test that special project and throws the hard failure.

The weird thing is Code Analysis is running on the TFS build agent without incident. This leads me to think that the issue is Studio related and specific to the version installed locally. However, I have tried this with VS2013 RTM, 2013 Update 5, and VS2015 Update 3 and they ALL behave the same. Create a new PHA, follow the prompts for local development using MVC, and then run Alt-F11 and the issue reproduces.

Can anyone get Code Analysis to work on a SharePoint PHA?

0

There are 0 answers