Running Resharper code analysis outside of Visual Studio - resharper

Resharper includes various analysis rules which can be run on your solution from inside Visual Studio but is it possible to run these from say the commandline or as part of your autobuild? Resharper seems to be focused on running in Visual Studio but can it be invoked on solution or project files from outside the IDE?
UPDATE: Seems like TeamCity 7.0 EAP includes a way to execute the code-analysis while building
(blog post) so at least it can somehow be invoked and utilized as part of a CI process.

No, this feature is not currently offered by ReSharper. There is a thread on the JetBrains website related to this question and it can be found here.
Here's a quote:
Currently ReSharper has no interface
from running in a standalone batch
application. However, it is possible
to write such an application that
provides the functionality you're
looking for using ReSharper OpenAPI.
So apparently you could use the ReSharper OpenAPI to create the functionality you want; unfortunately, I haven't had any experience in using it so I'm not much help there.
Some links of interest...
ReSharper OpenAPI Developer Community
ReSharper public API and sample source code (aka. ReSharper PowerToys)

I think you want the functionality provided by fxCop. I am not aware of Resharper functioning outside of Visual Studio.

Looks like they're listening! First version available as a 30-day demo now: http://blogs.jetbrains.com/dotnet/2013/03/resharper-code-analysis-goes-beyond-visual-studio/

If you're looking for compliance of code to standards, take a look at StyleCop. You can tie it into msbuild and run the rules outside of the IDE.

No, it can not be run from commandline. I still hope that they add this feature since I requested it last october :)

Related

Specify C# version in ReSharper

I'm slowly migrating projects to VS2017 from VS2015. We have distributed team and until all is verified (there are issues with e.g. Reporting Services, SSIS, etc as there is not fully finished tooling - SSDT) I need the projects could work in VS2015 without changes.
C# projects in VS2017 use latest C# version by default in project settings (in my case it is C# 7.1) and ReSharper started to offer refactoring to these new features. However, I need to resist the temptation and wait until all is migrated (while I still need to be able to write and review code). I need to specify the version of C# to be 6.0. I can do it on per project basis but I would like to avoid this as I would have to go through each project, modify it and push it to source control and when the migration is done then I would have to switch it back.
Is there a way in R# to globally set the C# version in options (haven't found such a setting but maybe there's some hidden option?)
(VS2017 - 15.4.5, ReSharper 2017.2.2)
EDIT
For Typescript there is possibility to specify language level - either auto-detection or exact version. So for C# it could be similar - auto-detection from project settings or exact version. It would allow code review for specific language version without modification of the projects.
I'm adding here also the link to R# support page as I asked there too
Add the following string to solution settings file ({Solution name}.sln.DotSettings file in the solution's root folder)
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/#EntryValue">CSharp60</s:String>

Visual Studio 2015 code map external dependencies

I have a native Win32 project written in C and wanted to visualize my project's dependencies from external DLLs. Visual Studio 2012 and 2013 let me generate a code map which would not only show all my functions and their dependencies from each other using arrows, but also all external libraries I used, which functions I used from those and which of my functions called which external functions etc..
Now, in Visual Studio 2015, this latter part seems to be missing. I can not get Visual Studio to show my project's external dependencies. I only see the internal ones. So here's my questions: Am I missing something? Do I have to activate a specific option in my project settings? Or are those external dependencies just not working in Visual Studio 2015 right now?
Steps to reproduce: Create a new non-empty Win32-project. In the Architecture menu, select Generate code map for solution. You will only see Win32Project1.exe in the middle of the screen. Meanwhile, Visual C# seems to be fine, showing the external dependencies. Create any C#-project for comparison.
Thank you for taking the time to post this! This looks like a regression, as in Visual Studio 2013 an Externals group with external dependencies is shown for C++.
I've logged a bug on Microsoft Connect so that you're able to track this externally:
https://connect.microsoft.com/VisualStudio/feedback/details/1694695
I have posted this workaround on the link that Bogdan Gavril listed and hope it helps someone. Unfortunately, it requires that you enable "CLR" support for your project. Basically, it appears that the VC++ linker and librarian is looking for a flag that indicates some type of managed code. At the very least, the code map is dependent on the mscorlib.dll reference injection. To make the CLR issue (which adds a lot of unnecessary bulk for native code) less a problem, simply create a new build configuration for use only when you need code maps with external dependencies. Make sure you've selected "CLR Support" on the general options of the project properties configuration page. Then, clean (probably not necessary) your solution and generate a code map. You will find the external dependencies as expected!
Zac

Visual Studio - Mylyn Equalivent [duplicate]

Mylyn is a task oriented plugin that allows for example to assign a set of files to a task. Is there a Mylyn type plugin for Visual Studio?
Tasktop has just announced that it is bringing the productivity of Mylyn into Visual Studio! The beta version that is being released will support bringing tasks from HP ALM, Quality Center, and Bugzilla. It includes Mylyn's Task List and Task Editor. The next level of support, which will include compatibility with all existing Mylyn connectors, will be delivered after this beta. Further down the road Tasktop will also be delivering context capture and focus within the Visual Studio IDE.
The beta release will be happening end of November 2010.
See the recent blog post for more details.
David Shepherd, Tasktop Technologies http://www.twitter.com/davidcshepherd
The closest I've found is Tasktop, by the people that created Mylyn, but it's a standalone application that doesn't integrate with Visual Studio.
(Resharper is irrelevant).
Not even close to mylyn, but here is an open source addin for visual studio that helps to assign a list of source files to a "session" (you could think of the session as a "task")
http://dsmaddin.codeplex.com/
i'm not aware of anything open source but i do know that team system is setup to support this type of workflow.
resharper might also have features you are looking for but, again, not foss
I asked that question to the VS.NET Development team in Teched 2008.
She said that they've notice about Mylyn, but are still looking on it.
Task focusing plugin is not yet ready in VS.NET environment.
You may be interested in this news from Tasktop: http://tasktop.com/blog/tasktop/eclipse-mylyn-microsoft-visual-studio
I'll second tasktop. The newest version especially looks nice. Like orip said, it doesn't provide VS integration, but there's a Firefox extension which should be pretty nice... beats using Eclipse purely for Mylyn.
I've recently released (commercial) Task Canvas extension for Visual Studio 2015 that supports tasks with assigned sets of documents and code fragments.

Obfuscation tool with click-once support

I have found a lot of obfuscation tools with no clickonce support.
Could you provide vendors with click once support?
I would like to deploy obfuscated software at once without adding ANY extra line of code (pre-buid, post build etc)
p.s. I believe that is software related
I can't speak for other obfuscation products, but this has been a request of customers of Dotfuscator.
An integrated method for obfuscating ClickOnce applications is not currently available but will be coming in the next major release of Dotfuscator. I know this, because the task is currently assigned to me :) .
If there is anything in particular that you would like to see please feel free to let me know and I'll make sure to keep it in mind as I work on it.
You can create the manifests outside of Visual Studio using mageui (run mageui from the visual studio command prompt). It requires a little more work, but you can create the manifests with the dll's post-compile. If you want to make it easier after the initial setup, you can create a nant build file to do all the steps for you using mage (command line equivalent to mageui).
I produce a piece of software called ClickOnceMore which can be used to create ClickOnce manifests from obfuscated assemblies. Its more user friendly than Mage and MageUI and has a command line version that can be included as part of a build process. I have several customers who use it in conjunction with obfuscators, particularly Dotfuscator.
You can find the software here: http://www.clickoncemore.net
The Dotfuscator software included in Visual Studio 2010 will obfuscate your code and re-sign the manifests for you. Prior versions would obfuscate, but then you had to re-sign the manifests yourself.

Any static code analysis tools for C# 4.0 yet?

Pretty straightforward question here: I like tools such as FxCop when it comes to scanning assemblies to get better insight into my code, and would like to start doing it on C# 4.0 assemblies. Any out there yet, or should I sit tight for a few more months while it's released and tools are updated?
What about Microsoft StyleCop for Visual Studio 2010?
The VS2010 beta includes a newer version of Code Analysis, which runs FxCop during the build process and displays the output as warnings. See the Code Analysis tab of project properties.
However, it's only available in the Premium and Ultimate editions. (See comparison)
I really wish that Microsoft would include it in the Express Editions and enable it by default for all projects; that might substantially improve beginner code.
The tool NDepend supports C#4, and even now C#5. It integrates inside Visual Studio 2012, 2010 and 2008. Disclaimer: I am one of the developers of the tool
The tool propose many facilities for your need of scanning assemblies to get better insight into my code, like Dependency Graph, Dependency Matrix, Code Metrics, Code Diff capabilities...
If you like FxCop, then you'll find useful the NDepend possibility to write Code Query and Code Rule over LINQ Queries (namely CQLinq). More than 200 CQLinq code queries and rules are proposed by default.
It is easy to write your own ones or customize existing ones. CQLinq queries are compiled and executed instantly and their results are presented in a browsable-friendly way, see the screenshot below:
The SD C# Clone Doctor statically analyzes C# (yes, even version 4.0) source code for duplication.
The CloneDR can be applied to large scale software systems, and typically finds 10-20% duplicated code.
There is a sample clone report at the link.

Resources