Using FxCop code analysis for .NET 4.5 applications - fxcop

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.

Related

SonarQube scanner for MSBuild missing CA issues

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.

How do I create a package of my application in VB.net which can run on other's systems too?

I made an application in Visual Studio 2012 using VB.net language.
I want to make a package or a setup so that any user whether they have visual studios or not can run my application.
I searched on internet and what I found is that there is something like statically or dynamically linking. Do these relate to my question?
Please give me a step by step method of packaging so that my application can run on Windows without needing Visual Studio or any other program to run it.
You will find it in the menu under Build -> Publish.
This will produce an executable that can be run without Visual Studio. The .NET Framework has to be installed on the computer though, but that usually is.

Can you recomment a better IDE for Unity C# coding? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
The current version of Unity uses the old MonoDevelop 2.8 which is very primitive. Not only that it cannot register compile errors, I am also unable to know which method I can use. Each time I want to use some built-in method (like OnGUI or OnTriggerEnter) I have to search them manually.
Since I am coming from the world of IntelliJ IDEA or Eclipse or VisualStudio, this is a very primitive way of working.
I tried using the latest Unity with the newest MonoDevelop 4.0, but I did not succeed.
Can you suggest a modern IDE which I can use with Unity, the one where I will enjoy coding?
Updated 02/08/2022
JetBrains Rider
There's a new cross-platform .NET IDE by JetBrains - Rider with build-in resharper-like commands and quite a list of features including rich web development support and specifically Unity
Unity support
Deeper integration with the Unity Editor: if a method/script is used in a scene, prefab, or asset file, navigating from the Find Usages tool window to this usage will highlight the usage right in the Unity Editor.
Gutter mark icons for classes, methods, and fields that are implicitly used by Unity have been moved to Code Vision.
Check that a compilation in Unity was successful before running unit tests through Unity Editor in Rider.
Comments: I've been using it for some time already and my impression is very positive. It's faster compared to Visual Studio and has some really awesome hotkey combos, not to mention support for AceJump and a ton of other useful extensions.
Visual Studio C# Integration
What does this feature get me?
A more sophisticated C# development environment.
Think smart autocompletion, computer-assisted changes to source files, smart syntax highlighting and more.
What's the difference between Express and Pro?
VisualStudio C# 2010 is a product from Microsoft. It comes in an Express and a Profesional edition.
The Express edition is free, and you can download it from here: http://www.microsoft.com/express/vcsharp/
The Professional edition is not free, you can find out more information about it here: http://www.microsoft.com/visualstudio/en-us/products/professional/default.mspx
Unity's VisualStudio integration has two components:
Unity creating and maintaining VisualStudio project files. Works with Express and with Profesional.
Unity automatically opening VisualStudio when you doubleclick on a script, or error in Unity. Works with Professional only.
I've got Visual Studio Express, how do I use it?
In Unity, select from the menu Assets->Sync VisualStudio Project
Find the newly created .sln file in your Unity project (one folder up from your Assets folder)
Open that file with Visual Studio Express.
You can now edit all your script files, and switch back to Unity to use them.
I've got Visual Studio Professional, how do I use it?
Note: With Microsoft's Acquisition of SyntaxTree, Visual Studio Tools for Unity (formerly known as UnityVS) has been released free of charge in the Visual Studio gallery.
This replaces the below steps for users of Visual Studio Professional and removes a number of caveats mentioned further below, allowing for debugging within VS, advanced project file integration, a mirrored console window withing VS, and more.
In Unity, go to Edit->Preferences, and make sure that Visual Studio is selected as your preferred external editor.
Doubleclick a C# file in your project. Visual Studio should automatically open that file for you.
You can edit the file, save, and switch back to Unity.
A few things to watch out for:
Even though Visual Studio comes with its own C# compiler, and you can use it to check if you have errors in your c# scripts, Unity still uses its own C# compiler to compile your scripts. Using the Visual Studio compiler is still quite useful, because it means you don't have to switch to Unity all the time to check if you have any errors or not.
Visual Studio's C# compiler has some more features than Unity's C# compiler currently has. This means that some code (especially newer c# features) will not give an error in Visual Studio but will give an error in Unity.
Unity automatically creates and maintains a Visual Studio .sln and .csproj file. Whenever somebody adds/renames/moves/deletes a file from within Unity, Unity regenerates the .sln and .csproj files. You can add files to your solution from Visual Studio as well. Unity will then import those new files, and the next time Unity creates the project files again, it will create them with this new file included.
Unity does not regenerate the Visual Studio project files after an AssetServer update, or a SVN update. You can manually ask Unity to regenerate the Visual Studio project files trough the menu: Assets->Sync VisualStudio Project
Visual Studio Code (Windows, macOS, Linux)
Unity supports opening scripts in Visual Studio Code (VS Code). To open scripts in VS Code, go to Unity > Preferences > External Tools > External Script Editor and select Visual Studio Code. For information on using VS Code with Unity, see Visual Studio’s documentation on Unity Development with VS Code.
Prerequisites
To use Visual Studio Code for C# code editing and Unity C# debugging support, you need to install:
Mono (only required on macOS and Linux)
Visual Studio Code C# Extension
Visual Studio Code Debugger for Unity Extension (Not officially supported by Unity)
Sources:
http://docs.unity3d.com/Documentation/Manual/VisualStudioIntegration.html
https://docs.unity3d.com/Manual/ScriptingToolsIDEs.html
In Mac
1) Visual Studio Code
Lightweight
Support debug
https://code.visualstudio.com/
2) Consulo
Intellij IDEA based IDE
Support debug
https://github.com/consulo/consulo
3) Sublime Text also can be your choice on Mac.
Using Sublime Text as a script editor
There are some useful packages for unity too. (Code Completion, Syntax coloring...)
ST package for unity3d
And Video Tutorial
You can use MonoDevelop or SharpDevelop. I need to highlight that all the capability in the .NET framework and not in the IDE in other words you can use text editors and CLR compiler without the need to use any IDE.

Make ReSharper run test using .net Framework 3.5

I am currently testing sharepoint components using msTest, which works nicely. However, when I run my testst using ReSharper all tests fail because ReSharper (6) is running the tests using .net Framework 4.
Is it possible to configure ReSharper (6) to run all tests using .net Framework 3.5 (CLR 2)?
In case you use Visual Studio 2010: This is an issue in Visual Studio, not in ReSharper.
See Microsoft's answer:
Hi Chris,
In VS 2010, the Test Team has made a painful yet concious decision to
not support multi-targeting. As a result, test projects will be
upgraded to target .NET 4.0. We have made some, workarounds to allow a
VB Test Project that references an MVC code under test to not upgrade,
but in general, all others will be retargeted. The VB 3.5 Test Project
sill has some limitations and will always run tests in a .NET 4.0
process. Also, you cannot take the tests and run them on a VS 2008
test system.
Thanks Visual Studio Product Team.
in site http://connect.microsoft.com/VisualStudio/feedback/details/514130/visual-studio-2010-beta-2-silently-upgrades-mstest-test-projects-to-net-4-0.

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