I would like to manually run code analysis for an entire solution, not on building the project, and not using FXCop, if possible. I did enable CA on build but it really, really slowed down the build process, and we can't have that. But it seems weird to me that code analysis can only be run per project manually through the menus, but not for an entire project.
Am I missing something?
Thanks.
In Solution Explorer, select the project. On the Analyze menu, select Run Code Analysis on [Project Name].
Build and run your code in Visual Studio To build your project, choose Build Solution from the Build menu. The Output window shows the results of the build process. To run the code, on the menu bar, choose Debug, Start without debugging. A console window opens and then runs your app.
You simply need to change the line "externalConsole" and set it to "true". And that's basically it. After that you simply Run your program with (F5). Keep in mind that if you change something in your original code you need to run it with "Run Code", (ctrl+alt+n) so that the uptades you do get saved and "compiled".
You can stop it by changing Options->Projects and Solutions->ASP.NET Core->Auto build and refresh option . Or you can simply kill the web server while editing.
I also don't know of a menu/command that can be used to run CA for all projects, but you can create a new solution configuration (e.g. CodeAnalysis based on Debug) and set up CA for each project to run for that Configuration, letting you run CA for all projects without slowing down your regular Debug build.
Create the new configuration called "Code Analysis" (Build -> Configuration Manager, then <New...> under Active solution configuration).
In the CA properties tab for each project, set CA to run for the "Code Analysis" configuration, and not to run for the Debug configuration (and any other Configurations you don't want CA to run on).
You can do the same on the Code Contracts tab if you normally don't want contract checking on your regular build configurations.
Now when you set your solution configuration to Debug and build, you should not have CA and CC being performed. When you do want the CA and CC checks done, change the configuration to 'Code Analysis' and build.
It's not as convenient as a menu or toolbar option, but it might be an alternative that works for you.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With