When I created project in VS2015 Roslyn is added by default, and I am also using Resharper in my project so can anyone help me to understand any advantages of Roslyn vs Re-sharper
Roslyn is CaaS (Compiler as a service) and enables several features in VisualStudio and additional extensions that can be installed. ReSharper doesn't use Roslyn, but has its own model for code analysis that already serves for over a decade.
Here is a comparison matrix:
https://www.jetbrains.com/resharper/documentation/comparisonMatrix_R2017_1_vs2017.html
Roslyn is the C# compiler and the default C# IDE features. You cannot have a C# project without Roslyn. Resharper adds more C# IDE features (some of these overlap with the default).
Related
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>
We have a large VS2012 solution (~250 projects) that is 90% C#. 2 of the 3 C++ projects use the 'v110' Platform Toolset. The third has to use the 'v110_xp' toolset for compatibility with a third party library. Our nightly TFS (2012) build is configured with 'Perform Code Analysis' set to Always.
Unfortunately, the v110_xp platform does not support code analysis (MSDN Blog). This results with the following build failure:
Microsoft.Cpp.Win32.v110_xp.targets(28,5): error MSB8026: Static analysis is not supported with the current platform toolset.
Any ideas how we can prevent code analysis from running on this single project without enabling (by default) code analysis for all projects (except the one)?
You should change the build to be "As Configured" and select I your solution which projects to run analytics on and which not.
https://msdn.microsoft.com/en-us/library/dd547175.aspx
Changing the following helped me:
Configuration Properties -> General -> Platform Toolset
Change was from v120_xp to v120
How would I go about using F# or J# for instance? I'm not sure what to get to grips with in the project's compiler settings.
Is there a sequence of command line steps I could follow to compile a MonoTouch project that I might interpret to replace the C# step but tell the other compiler to use the correct platform details etc?
Thank you.
Unfortunately, no. In the book "Developing C# Apps for iPhone and iPad using MonoTouch" you could see text (proof):
C# Is Currently the Only Language
Additionally, currently, the only .NET language available for writing MonoTouch applications is C#.
Nothing changed since that book publication.
Maxim Korobov is right, MonoDevelop only supports C# when writing for MonoTouch.
But this is not the whole truth: MonoDevelop also has (preliminary) support for Portable Library Projects (PLP). What this means is that you can create and compile PLP projects in Visual Studio (in any language Visual Studio supports for PLP projects), and then reference that library in MonoDevelop. Just have in mind that the PLP support is preliminary right now, and you might run into a few bumps on the way.
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.
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 :)