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.
Related
I have a couple of Projects created in visual basic 6 with oracle databases. I want to upgrade these proejects to visual studio 2012 and use TFS version control. I have read that first I need to upgrade to Visual studio 2008 and then to Visual studio 2012.
Before going ahead with the upgrade ( I need to install Visual studio 2008 as well) I want to make sure this is a realistic approach. So
1. Does converting a vb6 project to VS 2012 ok or I will have to make a lot of changes to make things work?
2. After upgradation would I be able to use TFS for the projects?
TL;DR - yes, you'll need to make lots of changes regardless of how you choose to migrate. TFS question seems irrelevant to me. If you're setup to use TFS for projects, you can use it for these after upgrade as well.
The only reason to consider a 2-step upgrade that includes VS 2008 is that was the last version that included the migration tool built-in (ie, free). As others alluded to, those tools don't make pretty code but a mashup of VB6 and .Net. After trying a few times, I now personally find it simpler and more robust to recreate a new .Net version from scratch, but using the VB6 code as a template. I copy and paste as practical and then do Find/Replace to catch the majority of errors/warnings and then deal with all the others individually. If I have to convert another project, I may use 2008 once just to see what kind of issues the original code had or if there are any unusual situations/controls I'll need to deal with, but I would still start a new 2013 project from scratch. That gives me a better opportunity to improve it as well. You'd be replacing all the connecting code to Oracle anyway. I'd been using OO4O and moved to ODP.NET. If you used 2008, you would have to move to at least 2010 to use the latter in managed mode, which is great not having to load Oracle Client on each machine.
I'd be wary of upgrading VB 6 to VB.net using the automated tools. I did it back in the day (around 2003) when .net was just starting out and my memory is that it wasn't a pleasant experience.
The code produced by the upgrade wizard is a nasty mix of old VB conventions trim, instr and .net conventions. We also had a bunch of weird bugs. Sorry it was a long time ago and I can't remember any details. Only that we did it once for a small number of components, around 6 or 7 activex dll's. That experience was bad enough that we decided it wasn't worth the pain.
We kept the VB 6 code in service until it was re-written as part of a larger push to modernise the codebase.
If you do decide to upgrade then the output is a standard visual studio project that can be source controlled in TFS just like any .net project.
If you reason for upgrading to just to use TFS then take a look at the MSSCCIProvider. This allows you at hook TFS in to the VB6 IDE
I am doing something very similar and did develop a tool to assist with the designer portion of the conversion. It parsers the VB6 file and creates designer code for .NET.
The source is here.
https://github.com/rdejournett/VBtoNET
The only thing I was not able to solve is that controls within tab pages have really wierd X locations like -60000. So I parse those to 0. You'll have to move them to the right place.
We have to decide which technology to use for our unit testing. Currently we use Visual Studio 2010 and not happy with MSTest that came with that. It is buggy, poor in deployment (E.g the test setting output directory is not recognized correctly), and have several issues when trying to test assemblies in 32bit and 64bit versions. To make matters worst MSTest does not have a good impedance match with our Jenkins build system. We therefore thought of moving into NUnit. However, no one in our team has a good exposure to NUnit. Also,we will be soon moving into Visual Studio 2012.
I need to know the pros and cons of Visual Studio 2012 MSTest vs Nunit latest version. Since most of the articles on stack overflow are related to older versions of VS they are not related to us. I guess Microsoft has improved MSTest a lot since 2010. Please provide an unbiased comparison with detail technical issues you have faced in both technologies (newer versions only)
I'm using both MSTest and NUnit at the moment. IMHO NUnit is still a better solution. If you have Visual Studio 2012 Premium edition then it's actually quite nice, except for the fact that you can't seem to group together tests. I like the fact it's integrated into Visual Studio, but the lack of grouping and the ability to run a subset of tests without manually selecting them is a huge problem.
The coverage analysis is also pretty neat in Premium. It's fast and gives you what you need quickly. It is a Premium feature though.
Since there are still lacking features in MSTest (even removed features since vs2010), I would still recommend using NUnit for unit tests. The benefits include test grouping by namespace, the ability to add test case annotations (running the same test multiple times with different parameters) and it works well with Opencover and Report Generator for coverage analysis. The main cited con is that it's not integrated like MSTest, so it really depends how much that matters to you as to whether or not that is a con.
#Biranchi: It doesn't matter anymore which unit test framework you use in Visual Studio 2012 (and upwards). See my blogpost here, the sequel to the one you refer to. http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/20/part-2-using-traits-with-different-test-frameworks-in-the-unit-test-explorer.aspx
You can even mix and match tests from different frameworks, you can even do that down to the method level !!
This means you can even move legacy code from one to another with no bad sideeffects.
Also see this for how to use Nuget to install the NUnit adapter into the solution, freeing the developer for installing it herself.
http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/11/part-3-unit-testing-with-traits-and-code-coverage-in-visual-studio-2012-using-the-tfs-build-and-the-new-nuget-adapter-approach.aspx
#Sriwantha: MSTest is a simpler framework than NUnit. NUnit (and also XUnit) give you more flexibility, which also leads to less code to write. One example: If you are using categories (and you should), MSTest require a category to decorate every method. NUnit allows you to decorate the class - that will take effect for all the methods in that class. NUnit also allow to you use strongly typed categories
public class Integration : Category {}
This is enough to declare a category that you can use instead of
Category("Integration");
where you risk spelling errors.
NUnit has much better support for data driven tests.
NUnit has also support for theories
to name a few.
VS2012 does allow categorization of tests into groups if you have "Update 1" or later:
http://msdn.microsoft.com/en-us/library/hh270865.aspx#BKMK_Grouping_and_filtering_the_test_list
Have you looked into Traits functionality of VS ?
http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/09/how-to-manage-unit-tests-in-visual-studio-2012-update-1-part-1-using-traits-in-the-unit-test-explorer.aspx
Grouping is much better in mstest (2012 update 1) compared to nunit.
One more thing to add here. It looks like MSTEST engine doesn't work well with TFS Build in certain scenarios. If you are using TFS build, it won't report the skipped tests (marked with Ignore attribute). It will only include Assert.Inconclusive. If that's an issue, you should use NUnit instead of MSTest.
I'm looking for the Pex Addin for VS 2012 (or its equivalent).
I know Moles became Fakes (http://msdn.microsoft.com/en-us/library/hh549175.aspx) which is present. I want the Pex part as input generator for automated WhiteBox testing. I'm not sure how I can do this within VS2012. Could someone give me a pointer here?
The Pex Team say that they're going to build a new release of Pex, but the simultaneous move from Moles to Fakes is causing 'some changes to how things work internally, and is delaying the next release of Pex'.
One of the contributors to this question got some information from Microsoft saying that they expect the academic licence to be available in early 2013.
Finally Pex has something for Visual Studio 2012: Code Digger (http://visualstudiogallery.msdn.microsoft.com/fb5badda-4ea3-4314-a723-a1975cbdabb4). You can ask it to generate a input / output table, with parameters that will cover all your code.
However, it supports only Portable Libraries projects today... let's wait for new releases.
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.
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 :)