Terje Sandstrom

------ Chief Software Geek at Inmeta Consulting in Scandinavia ----- and a Visual Studio ALM MVP

  Home  |   Contact  |   Syndication    |   Login
  62 Posts | 1 Stories | 104 Comments | 0 Trackbacks

News

Subscribe

Delicious Save this on Delicious Visual Studio Feeds

¨

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Company stuff

Interesting bloggers

Interesting companies

Microsoft

Microsoft Norge

Microsoft Regional Directors

Microsoft Test

MSFT Blogs

MVP

NNUG

Other interesting stuff

TFS

Visual Studio

Friday, November 14, 2014 #

NUGET

The current version 1.2 of the NuGet adapters for NUnit works with the VS 2015 Preview (and earlier CTPs). 

You can find them here:  http://www.nuget.org/packages/NUnitTestAdapter/  and with framework: http://www.nuget.org/packages/NUnitTestAdapter.WithFramework/

Add one of these to your solution and it works without having the VSIX installed, both for VS2015 and for TFS build, including VSO build.  Note that you only need to add one of these to one of your projects in the solution. 

The use of these NuGet based adapters is preferred since they don’t require any developer to install anything on his own machine, and also make it easier to run on TFS build.

I prefer to install them by opening the NuGet console, and choosing a relevant project, just one of the test projects, it doesn’t matter which one.

image

Choosing (1), the console, takes you into the screen below:

image

NOTE:  If you do get the yellow line warning, and you don’t have it in the cache, you must use option 2 below.  This is a bug somewhere in the console, since this work from the Manager shown below.  There are different workarounds on the net, but none seems to work consistently.

In my case it worked because I had it in my local cache.

 

Choosing (2), the manager, takes you into the new NuGet dialog below:

image

And then writing some tests and verifying it works in Visual Studio  2015

image

using NUnit parameterized tests – isn't that cool !

VSIX

The VSIX must be enabled for 2015, and we will update it pretty soon - but you can grab a debug preview at https://bintray.com/nunit/NUnitAdapter/NUnitAdapter/1.2.0.1/view

(This VSIX will be updated when a newer production version appears.)

There is also  no real code changes here, so it should work fine, but we have not run it through all the testing yet.  If you find anything, please report it at https://github.com/nunit/nunit-vs-adapter/issues .  That really helps us.

Note that the same VSIX also works with all previous Visual Studio versions, after VS 2012.

ASP.NET 5

These adapters works with the standard .Net 4.5 projects, but they will NOT work with the new ASP.Net 5 projects, they require a K-runner, and we have not finished that yet.   I will update this post when it is ready.


Friday, September 19, 2014 #

Go to Part 1 – List of Product Updates for information on Visual Studio and TFS 2013 updates

Looking for the VS 2012 product updates and extensions ?  Go to Visual Studio 2012 Product and updates (Part 1)  and Visual Studio 2012 extensions (Part 2)

Looking for the VS 2010 extensions ? Go to Visual Studio 2010 - List of Product Updates (Part 1) + Extensions (Part 2).

Looking for links to the test adapters, go to this blog post.

Update Sep 19th 2014:  Updated ReSharper3 , NDepend3LinqPad, TFS Team Project Manager,    Code Contracts1

See earlier update notes

This post is a list of the extensions I recommend for use with Visual Studio 2013. It’s coming up all the time – what to install, where are the download sites, last version, etc etc, and thus I thought it better to post it here and keep it updated. The basics are Visual Studio 2013 connected to a Team Foundation Server 2013, although most also works with earlier versions. 

Many live in a side-by-side environment with Visual Studio 2010 and 2012. The side-by-side is supported by VS 2013. However, if you installed a component supporting VS2013 before you installed VS2013, then you need to reinstall it. (Components marked with Note 3 below) The VSIX installer will understand that it is to apply those only for VS2013, and will not touch – nor remove – the same for VS2010 and VS 2012. A good example here is the Power Commands.

The list is more or less in priority order.

The focus is to get a setup which can be used for a complete coding experience for the whole ALM process.

The list of course reflects what I use for my work , so it is by no means complete, and for some of the tools there are equally useful alternatives. 

The components directly associated with Visual Studio from Microsoft should be common, see the Microsoft column.

For components that are updated through the gallery, I will no longer update the latest version numbers, as they are easily controlled through the Tools/Extensions and Updates dialogue. In the version column I will just write Auto.

If you want to use the same set of extensions on multiple computers, you might like to share them easily. Lars Wilhelmsen has a great blog post about how to use Dropbox to share extensions and common settings.

Extensions ready for VS 2013, both upgrades and new ones

Product Notes Latest Version License Applicable to Microsoft
File Nesting Awesome and convenient Auto Free Visual Studio MSFT
AutoHistory Awesome, local history Auto Free Visual Studio MS Devlabs
EF Power Tools Beta 41 See blog post Auto Free Visual Studio Yes
MyHistory1 See MSDN Article Auto Free TFS Integration No
Inmeta AssociateRecentWorkItems1 Fast way to associate recent work items to a checkin, reduce need to search around.  See Jakobs blogpost for more info Auto Free TFS Integration No

Unit Test Generator1

Get back the ability to generate unit tests from code, also works for NUnit and XUnit. Auto Free Unit Testing (VS) ALM Rangers
Codelens Code Health Indicator  12 Awesome !  See this post (Norwegian), and this and this. Auto Free Coding & Quality Yes
Runsettings1 Item template to create default runsettings file Auto Free Unit Testing (VS & TFS) No
TypeScript See info here, and B.Harry’s blogpost. Codeplex here
Release notes
Now part of VS 2013, installs with that 
See http://www.typescriptlang.org/
1.0 Free Coding Yes
ReSharper3 Note:Version 8.1.23.546 and earlier have an issue with Nuget/NUnit/Chutzpah, see here.  Download version 8.2 to get this resolved.
Version 8.2.1 have an issue with nuget, see this post 
8.2.2000.5120 Licensed Coding & Quality No
NuGet Manager   3 New initial install included with VS 2013. Updates through extension gallery Auto Free Visual Studio Yes
TFS Power Tools
See Brian Harry’s blog post for more info

12.1.00402.0 Free TFS integration Yes
NDepend3 Info on updates here. Trial available.

5.4.1.8430

Licensed Quality No
Build Manager1 Community Build Manager. Info here from Jakob Auto Free TFS Integration No
Visual Studio 2013 SDK Required for using Wix Published 11.Oct.2013 Free Visual Studio Yes
Wix Toolset 3.8 Free Coding/Installers No
Productivity Power Tools1 Awesome package. A must have! Auto Free Visual Studio Yes
Code Contracts1 3 Now on gallery too. Info here and follow the forum here
See new blog here
1.7.10908.11 Free Coding Yes
Code Contract Editor Extensions1   1.5.60813.10 Free Coding Yes
Visualization and Modeling SDK Requires VS 2013 SDK
Nov 10th 2013 Free now, otherwise Part of MSDN Subscription Modeling, DSL, UML extensions Yes
Slow Cheetah1 3 Tool for transforming XML files, like config files. Auto Free Coding No
Web Essentials1 Auto Free Coding Yes
Devart T4 editor Nice T4 editor, using this now instead of tangible. Auto Free Coding (T4 templates) No
tangible T4 editor1 Lite version is free and more than enough for T4 editing. 2.2.3 Lite version Free (Good enough) Coding (T4 templates) No
ASP.Net and Web Tools 2013 Free Coding Yes

#1 Get via Visual Studio’s Tools | Extension Manager (or The Code Gallery). (From Adam : All these are auto updated by the Extension Manager in Visual Studio)

#2 Works with ultimate only

#3 Also works with VS 2010 and VS 2012

 

Tools (outside Visual Studio)

Product Notes Latest Version License Applicable to Microsoft
ILSpy Decompiler –open source. Can also export assembly as C# project 2.2.0.1706 Free Coding/Investigation No
DotPeek Decompiler from Jetbrains. Can also export as C# project 1.2.1.226 Free Coding/Investigation No
LinqPad Info here 4.51.03 Free and licensed versions Coding No
           
TFS Team Project Manager Extremely valuable. Handle maintenance of work items, process, and much more across multiple team projects at once.  No more batch files with witadmin! See it at Codeplex  1.7.5119 Free TFS No
TFS Administration Tool Handling security and permissions in TFS, Sharepoint and reporting services. Open source tool at Codeplex
Version 2.3 is fully 2013 compatible. If you don’t have VS installed, download and install the TFS 2013 Object model
Version 2.2 works on 2013 but requires the 2012 Object model to be installed.
2.3 Free TFS No

 

Extensions we wait for, not yet in a VS 2013 version

Product Notes Latest Version License Applicable to Microsoft
Inmeta Build Explorer     Free TFS integration No
           


Thursday, September 18, 2014 #

I just got into some strange errors after I had done a NuGet update-packages of some package.  The build of the solution after the update failed with a strange error on some numeric comparison which could not be done:

image

This one followed by an error list like this:

image

Restarting Visual Studio makes it go away, but it is still a nuisance.

Since this happened after a NuGet operation I found it useful to mention this to Xavier Decoster , the author of the Pro NuGet book, and also one of the founders of the superb MyGet service, and he asked if I might be using ReSharper.  Which I of course could confirm, who doesn’t ?

It turns of the issue is caused by ReSharper, and was just recently fixed in an update 8.2.2 (I had 8.2.1). 

 

So go upgrade your ReSharper to 8.2.2, before you do any Nuget Update-packages commands Smile


Monday, July 7, 2014 #

Looking for List of VS 2013 Extensions (Part 2)

Updated Oct 17th 2014: Visual Studio and TFS 2013 Update 4 RC

Looking for the VS 2012 product info and extensions?  Go to Visual Studio 2012 Product and updates (Part 1)  and Visual Studio 2012 extensions (Part 2)

Looking for the VS 2010 extensions ? Go to Visual Studio 2010 - List of Product Updates (Part 1) + Extensions (Part 2).

Looking for links to the Test Adapters.

 

The information contains the download links to all versions and updates where applicable, links to information about each version, the version number for each, update time (for later ones) and the release dates. I have also added prerequisites, like the SQL server version necessary.

This is the major download link for all official Visual Studio products.

 

Product Notes Version number Date Applicable to
Visual Studio and TFS 2013 Update 4 RC See   KB2994375, Brian Harry blogpost, John Montgomery blogpost, web features post,  release notes. 12.0.31010.00 Oct 16th 2014 Visual Studio & TFS
Visual Studio

TFS 2013 Update 3

Update 3
See kb2933779 and Brian Harry blogpost 12.0.30723.0 Aug 4th 2014 Visual Studio & TFS
Visual Studio and TFS 2013 Update 2 See KB 29227432, news and Brian Harry’s blogpost 12.0.30501.00 May 12th, 2014 Visual Studio & TFS
Visual Studio 2013 Update 1 See info : KB 2911573, 12.0.30110.0 Jan 20th 2014 Visual Studio
Visual Studio and TFS 2013
download link
The RTM version of Visual Studio 2013  (Note 3)

12.0.21005.1

Nov 18th 2013 Visual Studio and TFS
SQL Server 2012 SP1
or
SQL Server 2012 SP2 
or
SQL Server 2014
The TFS 2013 require minimum the SQL 2012 server, SP1
Also see Manually Install SQL Server for TFS 2013
2012 SP1: 11.0.3000.0
2012 SP2:
11.0.5058.0
  SQL Server 2012 SP1

 

Note 1

The version number of Visual Studio is not changed when installing this patch.  The only place you see it is in the Installed Updates list

image

Note 2

The Update 1 RC doesn’t include the Queue Build patch.

Note 3

There was a rerelease of TFS 2013.  The first release had a bug which appeared in the Web UI, Code section, History.  If you get a red cross there, you got the first release.  You then need to reinstall.

Unsure which version and update you have  ?

Visual Studio:

Go to the top menu, choose Help | About

image

Note that both the name of the update and the corresponding version number is given.

Go to the top menu, select Tools | Extensions and Updates. Under the Updates | Product Updates section you will see if there is a new update ready for you. Note that pre-releases and hotfixes don’t arrive here.

image

(Image from VS 2013 preview, but it is the same in VS 2013)

To the far right you see the version number you have, and what version to update to.  Since the updates are cumulative, you don’t need to worry about those in between.

 

Team Foundation Server (on premise):

Use the web access for the TFS. Go to the Help Icon to the far right, and choose “About” from the menu:

image

In this case I have a TFS 2013 preview server.

Team Foundation Service:

If you are connected to the  Team Foundation Service you will not find any version number.  It is also always updated to the latest version.  You could check the service status page to see if all is working, and to see what has been done at the updates and release notes listed here.

 

Thanks

Thanks to Adam Cogan for valuable help in structuring these posts


Thursday, July 3, 2014 #

The .gitignore file contains rules for what files and folders to exclude from git source control.  When you use NuGet you don’t want the binaries retrieved by NuGet to be included into your git repository.  The binaries (and other files) from a NuGet package is downloaded into a folder named packages by default.   You need to add some rules to the gitignore file to exclude this folder from the repository.

Visual Studio comes with a standard gitignore file.  Althought this file contains a Nuget section, it is unfortunately commented out  (VS 2013 Update 2), so you manually have to fix this, or use the IFix utility.  (Blogpost here).

The latest Visual Studio gitignore file can be found on the github gitignore repository.  IFix can also download this file for you. (Visual Studio does not)

Updated 8.Jul. 2014This file now has the option 3 below, which works for git version 2.0.1, if you have a lower version, use IFix to add in Option 4 if you require top level exclusion.

Also updated this post with a  simple decision table, see bottom of the post.

Where does VS place the packages folder 

VS (with nuget) will by default create a packages directory at the first project directory level, which is one down referred to the gitignore file (given you say no solutiondirectory when you create the project/solution).  Any subsequent projects created will use the packages folder of the first created project.

If you choose to create the project (and solution) with a solution directory, the package folder will be placed within that directory and each project will be below that.

In no case is the packages folder placed at the root level of the repo, where the standard gitignore file will be placed.

Some developers however, prefer to have the packages folder at the root level, and simply “move” it there, by editing the Repository path in the nuget.config file, see the docs, sot he pattern need to cover that too. 

What is to be excluded and re-included

Normally you want to exclude everything in the packages folder, but there are two typical re-includes, MSBuild build files - those are placed in a subfolder named “build” under the packages folder (you might need this if you do native C++ packages, otherwise probably not), and a file named repositories.config.  The latter is normally regenerated, so you shouldn’t really need to store it in source control, but some developers prefer to do so.

To demonstrate how this works, I have set up a project with package folders at both top level and a sublevel, and with build folder and a repositories.config file to be re-included.

image

1 and 2 are the packages folders.  3 is a nuget package we want to be excluded, 4 is some text files that we also want to be excluded, whereas the build folders and their content and the repositories.config files are to be included.

 

The different possible patterns for exclusion

Option 1:  The VS included gitignore

The section looks like this:

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

As mentioned above, you must uncomment the last line here. 

packages/

This exclusion will work for a package folder at any level, but it will not accept any re-includes.  If you try to add any re-includes, they will simply be ignored.

If we add a re-inclusion for the build folder, the result will be as shown below (I use VS to show this, but the “git status” command will show the same) :

image

The packages folders are excluded, blue arrow, the build folders are reincluded, red arrow, and thus should appear, but they don’t. 

Conclusion:  This pattern only works if you don’t want to re-include anything.

 

Option 2: The current github gitignore file, using “packages/*” as pattern

The pattern looks like this, with re-includes:

# NuGet Packages
packages/*
*.nupkg
## TODO: If the tool you use requires repositories.config
## uncomment the next line
!packages/repositories.config

# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the lines above for that has been uncommented)
!/packages/build/

What happens now is this:

image

The exclusion and re-includes are as shown by the blue arrows.  The root level package folder is fine, green arrow, the build folder stays, the repositories.config stays, and the text files we had there are excluded.  BUT – the sub level folder – red arrow – is not fine at all, the build folder is ignored (because there are an exclusion for build higher up in the gitignore file), the NUnit package lib are present, and should have been excluded.

Conclusion:  This pattern only works for top level package folders, which are not a default of Visual Studio.

Option 3:  A pattern for subfolders that accept re-includes

If we add a pattern  **/ ahead of the other patterns it will work on subfolders, like

**/packages/*

it will cover any sub folders like option 1, and will accept re-includes, like option 2.

However, alone, this will NOT cover any top level folders, if you have version 1.9.4 of Git or lower.

image

We add the **/ to the three clauses, and we see that the sub folders are ok, green arrow, but the top level is now wrong.

However, note that if you use Visual Studio with the default locations of the package folder, this pattern will work.

Conclusion:  This pattern only works for sub level package folders, but will not work on a top level folder, which a developer may choose to use.

This has been fixed in version 2.0.1 of Git, but the current Windows version – which are always lagging – is 1.9.4, which still has this error.

 

Option 4: A combined pattern to cover both top level and subfolders

If we combine Option 2 and Option 3 we will cover all options here, the resulting clauses are then

# NuGet Packages
**/packages/*
packages/*
*.nupkg
## TODO: If the tool you use requires repositories.config
## uncomment the next line
!**/packages/repositories.config
!packages/repositories.config

# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the lines above for that has been uncommented)
!**/packages/build/
!packages/build/

And the results are:

image

All is green !

 

Conclusion:  This pattern works at any level of package folders, and works with re-includes at any level  but will not work on a top level folder.

Note 1:  The “**/” syntax is new from version 1.8.2 of git.

Note 2: A pull request for the github gitignore is here https://github.com/github/gitignore/pull/1131Update:  Merged July 7th 2014.

Note 3: IFix will be updated to option 3/4 in version 1.1, it will choose correct option based on your git version.

What exclusion pattern to choose

A simple decision table:

    Git version >= 2.0.1 <2.0.1
(Current for Windows is 1.9.4)
Have top level package No reincludes a) **/packages/*
b) packages/
packages/
Have top level package Have reincludes **/packages/* **/packages/*
packages/*
Have sub folder packages No reincludes a) **/packages/*
b) packages/
a) **/packages/*
b) packages/
Have sub folder packages Have recincludes **/packages/* **/packages/*

a):  Preferred  b): Optional

 

Current (July 8th 2014) defaults:

Gitignore from github:  **/package/*

Gitignore from VS default:  package/


Friday, June 13, 2014 #

Download tool

Updated 3.July 2014:  Corrected pattern for NuGet, details in this blogpost. (IFix is in progress to be updated too, version 1.1 will have these fixes)

Is there anything wrong with the built-in Visual Studio gitignore ????

Yes, there is ! 

First, some background:

When you set up a git repo, it should be small and not contain anything not really needed.  One thing you should not have in your git repo is binary files.

These binary files may come from two sources, one is the output files, in the bin and obj folders.  If you have a  gitignore file present, which you should always have (!!), these folders are excluded by the standard included file (the one included when you choose Team Explorer/Settings/GitIgnore – Add.)

The other source are the packages folder coming from your NuGet setup.  You do use NuGet, right ?  Of course you do !  But, that gitignore file doesn’t have any exclude clause for those folders.  You have to add that manually.  (It will very probably be included in some upcoming update or release).  This is one thing that is missing from the built-in gitignore.

To add those few lines is a no-brainer, you just include this:

# NuGet Packages
packages/*
**/packages/*
*.nupkg
# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# These two line needs to be after the ignore of the build folder
# (and the packages folder if the lines above has been uncommented)
!packages/build/
!**/packages/build/
Now, if you are like me, and you probably are, you add git repo’s faster than you can code, and you end up with a bunch of repo’s, and then start to wonder:
Did I fix up those gitignore files, or did I forget it?

The next thing you learn, for example by reading this blog post, is that the “standard” latest Visual Studio gitignore file exist at https://github.com/github/gitignore, and you locate it under the file name VisualStudio.gitignore.  Here you will find all the new stuff, for example, the exclusion of the roslyn ide folders was commited on May 24th. 

So, you think, all is well, Visual Studio will use this file …..    

I am very sorry, it won’t. Surprised smile

Visual Studio comes with a gitignore file that is baked into the release, and that is by this time “very old”.  The one at github is the latest. 

The included gitignore miss the exclusion of the nuget packages folder, it also miss a lot of new stuff, like the Roslyn stuff.

So, how do you fix this ?  … note .. while we wait for the next version…

You can manually update it for every single repo you create, which works, but it does get boring after a few times, doesn’t it ?

IFix

Enter IFix ,  install it from here.

IFix is a command line utility (and the installer adds it to the system path, you might need to reboot), and one of the commands is gitignore

If you run it from a directory, it will check and optionally fix all gitignores in all git repo’s in that folder or below.  So, start up by running it from your C:/<user>/source/repos folder.

To run it in check mode – which will not change anything, just do a check:

IFix  gitignore --check

What it will do is to check if the gitignore file is present, and if it is, check if the packages folder has been excluded.  If you want to see those that are ok, add the --verbose command too.  The result may look like this:

SNAGHTMLd9e57a9

Fixing missing packages

Let us fix a single repo by adding the missing packages structure,  using

IFix gitignore --fix

image

We first check, then fix, then check again to verify that the gitignore is correct, and that the “packages/” part has been added.

If we open up the .gitignore, we see that the block shown below has been added to the end of the .gitignore file.

image

 

Comparing and fixing with latest standard Visual Studio gitignore (from github)

Now, this tells you if you miss the nuget packages folder, but what about the latest gitignore from github ?

You can check for this too, just add the option –merge (why this is named so will be clear later down)

So,

IFix gitignore --check –merge

The result may come out like this  (sorry no colors, not got that far yet here):

image

As you can see, one repo has the latest gitignore (test1), the others are missing either 57 or 150 lines. 

IFix has three ways to fix this:

--add

--merge

--replace

The options work as follows:

Add:  Used to add standard gitignore in the cases where a .gitignore file is missing, and only that, that means it won’t touch other existing gitignores.

Merge: Used to merge in the missing lines from the standard into the gitignore file.  If gitignore file is missing, the whole standard will be added.

Replace: Used to force a complete replacement of the existing gitignore with the standard one.

The Add and Replace options can be used without Fix, which means they will actually do the action.

If you combine with --check it will otherwise not touch any files, just do a verification.  So a Merge Check will  tell you if there is any difference between the local gitignore and the standard gitignore, a Compare in effect.

When you do a Fix Merge it will combine the local gitignore with the standard, and add what is missing to the end of the local gitignore.

It may mean some things may be doubled up if they are spelled a bit differently.  You might also see some extra comments added, but they do no harm.

Init new repo with standard gitignore

One cool thing is that with a new repo, or a repo that is missing its gitignore, you can grab the latest standard just by using either the Add or the Replace command, both will in effect do the same in this case.

So,

IFix gitignore --add

will add it in, as in the complete example below, where we set up a new git repo and add in the latest standard gitignore:

image

Notes

The project is open sourced at github, and you can also report issues there.


Wednesday, June 11, 2014 #

Download tool

In version 2.7 of NuGet automatic nuget restore was introduced, meaning you no longer need to distort your msbuild project files with nuget target information.   Visual Studio and TFS 2013 build have this enabled by default. 

However, if your project was created before this was introduced, and/or if you have used the “Enable NuGet Package Restore” afterwards, you now have a series of unwanted things in your projects, and a series of project files that have been modified – and – you no longer neither want nor need this !  You might also get into some unwanted issues due to these modifications.  This is a MSBuild modification that was needed only before NuGet 2.7 !

So: DON’T USE THIS FUNCTION !!!

image

There is an issue https://nuget.codeplex.com/workitem/4019  on the NuGet project site to get this function removed, renamed or at least moved farther away from the top level (please help vote it up!).  The response seems to be that it WILL BE removed, around version 3.0.

This function does nothing you need after the introduction of NuGet 2.7.  What is also unfortunate is the naming of it – it implies that it is needed, it is not, and what is worse, there is no corresponding function to remove what it does !

So to fix this use the tool named IFix,  - all free of course, and the code is open source.  Also report issues at:  https://github.com/OsirisTerje/IFix 

 

IFix information

DOWNLOAD HERE

This command line tool installs using an MSI, and add itself to the system path. 

If you work in a team, you will probably need to use the  tool multiple times.  Anyone in the team may at any time use the “Enable NuGet Package Restore” function and mess up your project again. 

The IFix program can be run either in a  check mode, where it does not write anything back – it only checks if you have any issues, or in a Fix mode, where it will also perform the necessary fixes for you.

The IFix program is used like this:

IFix <command> [-c/--check] [-f/--fix]  [-v/--verbose]

The command in this case is “nugetrestore”. 

It will do a check from the location where it is being called, and run through all subfolders from that location.

So  “IFix nugetrestore  --check” , will do the check ,  and “IFix nugetrestore  --fix”  will perform the changes, for all files and folders below the current working directory.

(Note that --check  can be replaced with only –c, and --fix with –f, and so on. )

BEWARE: When you run the fix option, all solutions to be affected must be closed in Visual Studio !


So, if you just want to DO it, then:

IFix nugetrestore --check

to see if you have issues

then

IFix nugetrestore  --fix

to fix them.

How does it work

IFix nugetrestore  checks and optionally fixes four issues that the older enabling of nuget restore created.  The issues are related to the MSBuild projess, and are:

  1. Deleting the nuget.targets file.
  2. Deleting the nuget.exe that is located under the .nuget folder
  3. Removing all references to nuget.targets in the solution file
  4. Removing all properties and target imports of nuget.targets inside the csproj files.

IFix will fix these issues in the same sequence.

The first step, removing the nuget.targets file is the most critical one, and all instances of the nuget.targets file within the scope of a solution has to be removed, and in addition it has to be done with the solution closed in Visual Studio.  If Visual Studio finds a nuget.targets file, the csproj files will be automatically messed up again.

This means the removal process above might need to be done multiple times, specially when you’re working with a team, and as long as the solution context menu has the “Enable NuGet Package Restore” function.  Someone on the team might inadvertently use that function at any time.

It can be a good idea to add this check to a checkin policy – if you run TFS standard version control, but that will have no effect if you use TFS Git version control of course.

So, better be prepared to run the IFix check from time to time.

Or, even better, install IFix on your build servers, and add a call to IFix nugetrestore --check in the TFS Build script. 

 

How does it look

As a first example I have run the IFix program from the top of a set of git repositories, so it spans multiple repositories with multiple solutions.

The result from the check option is as follows:

SNAGHTML1218b841

We see the four red lines, there is one for each of the four checks we talked about in the previous section. The fact that they are red, means we have that particular issue.

The first section (above the first red text line) is the nuget targets section.  Notice  No.1, it says it has found no paths to copy.  What IFix does here is to check if there are any defined paths to other nuget galleries.  If there are, then those are copied over to the nuget.config file, where is where it should be in version 2.7 and above.   No.2 says it has found the particular nuget.targets file,  No.3  states it HAS found some other nuget galleries defines in the targets file, which then it would like to copy to the config.file.

No.4 is the section for nuget.exe files, and list those it has found, and which it would like to delete.

No 5 states it has found a reference to nuget.targets in the solution file.  This reference comes from the fact that the .nuget folder is a solution folder, and the items within are described in the solution file.

It then checks the csproj files, and as can be seen from the last red line, it ha found issues in 96 out of 198 csproj files.  There are two possible issues in a csproj files.  No.6 is the first one, and the most common and most important one, an “Import project” section.  This is the section that calls the nuget.targets files.  No.7 is another issue, which seems to sometimes be there, sometimes not, it is a RestorePackages property, which also should go away.

Now, if we run the IFix nugetrestore –fix command, and then the check again after that, the result is:

image

All green !


Saturday, February 8, 2014 #

This issue is resolved in the latest ReSharper release, version 8.2.0.2160, download here

The issue appears when using the Test Explorer to run tests in any of the frameworks mentioned in the title.  The tests are shown in the Test Explorer, but are not executed.  It may look like this:

image

Note:  The tests shown dimmed are NUnit and XUnit tests, which have the issue. The other tests are MSTests, which are not affected. The tests are discovered by the adapter, but not executed.

If you look in the Output window, under Tests, a message there says the message above, like:

image

image

image

One report of this issue is on the Chutzpah page.

The issue seems to have surfaced in different circumstances. Some people, including myself, noted the issue when we used the Nuget adapter for NUnit, which btw is a brilliant way of adding an adapter – and noted that it worked with the extension adapter but not with the NuGet adapter. With the XUnit and Chutzpah however, the issue appeared with the extension test adapters, so it was obviously not the way the adapters were installed that caused the issue to appear.

The common denominator was always ReSharper.  A similar issue was solved in version 8.0.2, but this seems to be another one coming up. 

The current issue is now solved in a pre-release version of ReSharper, version 23.904,  the latest official version is 23.546.  So note that you need to upgrade to this pre-release version if the issue appears. The 904 version doesn’t seem to have any other “bad” issues, as far as I have seen.

This blogpost will be updated when ReSharper is officially updated.


Monday, January 13, 2014 #

By Terje Sandstrøm and Syver Enstad

This article was originally written in 2003 and used internally within our company and for clients of our company.  The text is as it was at that time, and – given the general nature of this topic - should still be useful.

Introduction

There has been a lot of talk about design patterns, but not so much about code patterns, also referred to as idioms. A code pattern describes typical general code for common operations. This article focuses on operator patterns in C++. Not all classes need their own operators, but small classes which often represents some kind of value, will very often need a set of operators. Further, classes that use dynamic memory (heap allocation) must implement a copy constructor and an assignment operator (in addition to a destructor) if they are going to be copy able. (ref. The Big Three Law (B3L(see C++ FAQ).

In this article, we will make a catalogue of the typical operator patterns. Many of the patterns are due to other authors, the references can be found at the end. We have put all of them together and also elaborated on some of their implications.

The patterns are shown as combined declarations and implementations, as both are equally important. In many cases the operators are so small that they can safely be implemented in the header file, thus one can make them inline.

The challenge with operators is that they should be implemented as efficiently as possible, concerning both design time and runtime. Bugs caused by errors in operators can be harder to find than normal bugs, because when you use the classes in a program, you don’t see the difference between calling an internal operator or a user defined operator, so you tend to overlook them. We often find these bugs when single stepping through the program and then, very much to our surprise, we step into an operator implementation which existence was forgotten.

It is also important to note that custom class operators should conform to the interface used by the built-in types. In some cases, the compiler will transfer your definition to one compatible with the internal built-in types. Be aware of this. See for example the operator== below.

A good advice: Use operator overloading for syntactic sugar, and please do not stray from accepted semantics for an operator.

A general pattern observation

Several operators do nearly the same thing, only slightly different. As each piece of code can introduce a bug, it is good advice to only write an “algorithm” once, and then reuse it. It is similar with operator implementation – implement one operator in terms of another. This can in fact go quite a long way, as we show in this article, and it is a powerful technique. You get one more function call, but if speed optimization is highly demanded, you should make the operator methods inline, and the compiler will “remove” your function call anyway. Further, the golden rule we follow is to first make it work, then make it right, and at last make it fast.

As is the case with the Boolean and arithmetic operators below it’s often useful to implement all similar operators in terms of another member function. The Boolean operators are implemented in terms of a compare member function and the arithmetic functions in terms of their corresponding @= (+=, -=, /=) and so on.

Operator patterns table

Table 1 shows the operators discussed, and which of these is implemented directly and which one is implemented in terms of another.

Operator name

Must be member function

Operator short signature

Implementation

Assignment operator

Yes

Op=

Directly

Copy constructor[1]

Yes

 

Maybe in terms of assignment operator[2]

operator +=

No, but it probably should

Op+=

Directly

Prefix increment

No, but it probably should

Op++()

In terms of op+=

Postfix increment

No, but it probably should

Op++(int)

In terms of prefix increment

Addition operator

No, cannot be

Op+

In terms of Op+=

Subscript operators

Yes

Op[]

Directly, or member func

Stream operators

No, cannot be.

Op<< and Op>>

Directly, or member func in a class hierarchy

Equal operator

No, cannot be

Op==

Directly,

Non-equal operator

No, cannot be

Op!=

In terms of op== or member func

Less than

No, cannot be

op<

In terms of member function

Less than or equal

No, cannot be

op<=

“”

Greater than or equal

No, cannot be

op>=

“”

Greater than

No, cannot be

op>

“”

dereferencing operator

Yes

op*

Directly

dereferencing member selection operator

Yes

op->

Directly

Conversion operator

Yes

operator T

Directly

Function call operator

Yes

operator()

Directly

The operator patterns

Introduction

All patterns are described with pseudo code. The term C denotes the Class name of your class. The term X may denote a secondary class, which also may be equal to C. Member variables are just denoted as m_x. You should substitute your own members wherever you see this. We have kept the explanations rather short, so that this is more like a reference guide than a tutorial. For further discussions, you should look up the references.

We describe the patterns with the non-dependent operator first, and then follow with the operators that depend on the former.

Member or non member

Generally, operators that don’t modify any of its arguments should be implemented as free functions instead of member functions. Operators that modify the first argument often makes for shorter and more readable code if implemented as member functions and in some cases, like operator= it’s not possible to implement it as a non-member. Some operators have to be implemented as non-members. An example is the streaming operators, where it’s the second parameter that decides which operator to use, and you generally don’t want to modify the iostream classes each time you want a new implementation of the streaming operators, which is the only alternative if you’re going to implement it as a member function. All operators that can be used associatively, that is, a op b can also be called as b op a, must be implemented as non-members. This holds for many of the arithmetic operators and the comparison operators. You must be able to say bool b = 5>a ; This is valid, and should be allowed, but demands a non-member operator for the operator()>..

Difference in signature between member and non-member versions:

The non-member version of an operator will have an extra left-most parameter since it is not connected to any object.

Two typical binary operator signatures:

Member binary operator:

RetType C::operatorX(const ParamType& other);

Non-member binary operator:

RetType operatorX(const ParamType& lhs, const ParamType& rhs);

Operators for value types

The following operators do generally make most sense to implement for value types, or concrete types as they are also referred to (Str97). These types are generally very close to the built-in types of the language, and are implemented as classes where the concept of identity is generally irrelevant. Inheritance and virtual functions are seldom used in implementing such classes. This is in the contrast to reference types , objects of these classes are generally heap allocated and operated on through virtual functions.

The assignment operator, Op=

The assignment operator pattern is first shown for a single class, that is:

No inheritance
C& C::operator=(const C& other)
{
   if (this!=&other)
   {
       // copy members
       x = other.x; // and so on
   }
   return *this;
}

The assignment operator should always return a reference. That way it is possible to write code like a=b=c;

The first check is to verify that if we’re doing a=a, which is perfectly legal and which in fact happens when programmers use arrays, typedefs and other mechanism which obscure the simple fact that they are doing an a=a operation. In that case, we skip the rest of the assignment procedure.

Also, note that if the class contains dynamic memory, we have some options regarding deep or shallow copying of those blocks, which is not discussed in this article.

Inheritance

If class C inherits from class Base, then the pattern is as follows:

C& C::operator=(const C& other)
{
   if (this!=&other)
   { 
      // copy base
      Base::operator=(other);
      // copy members
      x = other.x; // and so of
   }
   return *this;
}

Note that the only change is the addition of the call to the base class assignment operator just before we start copying our own member variables. Note also that in this case we use the operator= function name of the assignment operator for the base class.

Diversion

Observe that the parameter is declared const. This has a special effect on any class that aggregates an instance of your class.

Assume you declare a class A like this:

class A
{
   private:
   C c;
   Public:
   // a lot of methods ......
}

In addition, in your code elsewhere you have something like

A a1,a2;

.... lots of code

a1 = a2;

Now when the compiler sees the assignment of a2 to a1 it will generate a default assignment operator for class A. Then comes the trap. When doing so, it will look at the member variables, and look at their assignment operators. If they ALL have assignment operators following the pattern above, with a const parameter, it will generate a similar assignment operator. If, however, one of the members (f.e. your class A) has an assignment operator where the parameter is NOT declared const, the assignment operator for class A will have a non-const parameter too.

If you think this is no big deal, just try to make a vector of A, like in

std::vector<A> va;

And look at all the nice error messages popping up from deep inside the vector template code. The reason is that the vector template demands that all members have assignment operators with const parameters because the vector must own the content.

Copy Constructor

Although this is not an operator, we have included this special constructor here, because it is part of the B3L (Big Three Law), and with some caveats, it may be implemented in terms of the assignment operator. Lets start with what a copy constructor should do. What we need for the implementation of the copy constructor is first default construction and then assignment. This is illustrated by the following example:

void Func(B& b)
{
   Obj a;
   a = b;
}

should mean the same as:

void Func(B& b)
{
   Obj a(b);
}

What is crucial here is that the precondition for calling the assignment operator is a fully constructed object, like one created by the default constructor. Following this line of thought, the ideal thing would be to implement the copy ctor something like this (pseudo code):

Obj(const Obj& other)
{
   CallDefaultCtor();  
   *this = other;
}

It is not possible to call the default ctor like this in C++, so we will have to settle for less. The first idea might be to put all initialization code into a member function, but functions cannot be called from the initializer list so this will not work for members who have to be initialized there (members with no default ctor). The general solution is therefore to duplicate the code from the default ctor to ensure that the object is in a valid state before calling the assignment operator. The class below illustrates this case:

 

class C
{
   private:
   int X;       
   const int Y;
   public:
   C() : X(0), Y(0) {};
   C(int Y) : X(0), Y(Y) {};
   C& operator=(const C& other)
   {
     if (this!=&other)
     {
        X = other.X;
     }
     return *this;
   }
   C(const C& other) : Y(other.Y) 
   { 
      *this=other; 
   }
};

In many cases the benefit gained from sharing implementation between operator= and copy ctor will be so little, and/or efficiency constraints will preclude it, so that it may be better to just implement the copy ctor directly.

NB: No matter how you define your copy ctor, remember this: It should always have the same result as default construction followed by assignment.

Arithmetic operators

The arithmetic operators are all implemented in terms of each other. We show the addition operators, but the patterns are similar for the subtraction, multiplication and division operators. They follow the same pattern, and have the same dependencies. For the sake of saving some space, we only show the addition operator patterns here. For example, for the subtraction patterns, just replace the +’s with –‘s and you should be doing fine.

Operator +=

This operator is the workhorse when it comes to arithmetic operators, and should always be implemented first when you need to do arithmetic on a class.

The pattern is:

C& C::operator+=(const X& other)
{
   x += other.x;
   return *this;
}
Addition operator

The addition operator should be implemented in terms of the op+=. The pattern for addition of an element is shown below.

const C operator+(const C& a, const X& b)
{
   C result = a; // more efficient than copy constr
   result += b;
   return result; // Note result value optimization[3]
}

The pattern is declared as a free function rather than a member of C. This is necessary in order to do operations on const values, like f.e. c = 4+a; where the number 4 no way can have a method called operator+.

The const return value stops you from writing

code like :

(a+b)=c;

Also, observe that the internal construction of the result object will have reduced negative effect due to the return value optimisation C++ compilers do. The compiler will optimise away this construction while looking at the calling code. (See Scott Meyer, item 20 in ref.2) If your code is

C a = 4;

C b = 6;

C x = a+b;

Then the compiler will combine the internal construction in the operator+ and the construction in the calling code, of x, leaving you with only one construction.

Also, note that we use an empty construction together with the assignment operator instead of a copy constructor, because the copy constructor is implemented in terms of an assignment operator. Since we know this, the assignment above is more efficient, and just as clear.

Prefix increment operator

There are two increment operators, one for prefix operations and another for postfix operations. We start with the prefix operator pattern, which is implemented in terms of the op+=. The postfix operator is implemented in terms of the prefix operator.

C& operator++()
{
   *this += 1; // Implemented in terms of op+=() 
   return *this;
}

It is natural to implement this in terms of the op+= because it is only a special case of that, which increments by one. The op+= increments by any value given.

Postfix increment operator

The postfix operator pattern has a strange signature. The pattern is:

C operator++(int)
{
   C old = *this; // more efficient than copy constr
   ++(*this); // Inc in terms of prefix oper++
   return old;
}

Note that a parameter with only the type int is used. This is a speciality just for telling the compiler that this signature is a postfix operator, and not a prefix operator. Without the int, there would be no differences between the two signatures. One can wonder why the standard committee choose this rather than make an explicit keyword that would be clearer to read like

C operator++() postfix

But I assume some old C guys are still present (pun indented!).

Also, observe that the postfix increment operator will return a copy of the old value. This is the reason why you should opt for the prefix increment operator, and only use the postfix if you need this behaviour. If you use the postfix inadvertently, you will have a useless object construction on your conscience.

A typical efficiency “error” many people make, especially old C-coders who are more used to the postfix than the prefix is in loops:

for (C i=0; i<N; i++)
{
   …..
}

Now for each iteration of the loop, a copy of ‘i’ is created and thrown away. The better way is thus:

for (C i=0; i<N; ++i)
{
   …..
}

Actually, this only holds true for user defined types. For built-in’s postfix is as efficient as prefix. But it’s a good rule anyway.

Equal operator

The equal operator has a binary and symmetrical form, and is thus defined as a function or a friend function if it needs access to the private representation. Both operands should preferably, or normally, be of the same type. You may of course define operator== with different types, which has been done in the STL for the string class, where three overloaded operator==’s exist. If you do that, implement two of those in terms of the first. If you also have an operator== it is important that the result of applying operator= to an object makes operator== return true for the two objects afterwards, or it will get people very confused.

class C
{
   public:
   friend bool operator==(const C& c1,const C& c2)
}

and implemented as

bool operator==( const C& c1,const C& c2)
{
   return c1.x==c2.x;
}
Equal operator for STL vector of pointers

If you have made yourself a vector of pointers, and you would like to use the find template algorithm on that vector, you will need a special operator== in your class.

class C
{
   public:
   friend bool operator==(const C* pc1,const C& c2)
}

and implemented as

bool operator==( const C* pc1,const C& c2)
{
   return pc1->x==c2.x;
}

and you call the find template as

vector<C*> v;
// code to fill the vector
C c; // object to look for
vector<C*>::iterator iter = find(v.begin(),v.end(),c)

Note that the find call uses the object to find as a reference argument, not a pointer as one could assume. The call is in fact equal to the call used for vector of objects (vector<C>), but a vector of objects uses only the standard operator==.

Non-equal operator

The non-equal operator follows the same rule as the equal operator, and is also implemented in terms of that operator.

class C
{
   public:
   friend bool operator!=(const C& c1,const C& c2)
}

and should be implemented as

bool operator!=( const C& c1,const C& c2)
{
   return !(c1==c2);
}

When you have only one member, this may seem a waste, but with multiple members, you save a lot of typing, and also a lot of possibilities for making errors.

A compare method and all the Boolean operators

If you need to implement all the Boolean operators it is often best to implement them in terms of a function compare that returns 0 for equality, < 0 for less and > 0 for greater.

class C {
   public:
   // Compare probably needs access to the representation of C
   virtual int compare(const C& other);.....
};

The reason for the compare method to be virtual is that in case of derivations, you won’t need to make new Boolean operators for the derived classes. All you need to do is to implement the new compare method in the derived class.

bool operator==(const C& lhs, const C& rhs)
{
   return lhs.compare(rhs) == 0;
}

bool operator!=(const C& lhs, const C& rhs)
{
   return lhs.compare(rhs) != 0;
}

bool operator<(const C& lhs, const C& rhs)
{
   return lhs.compare(rhs) < 0;
}

bool operator>(const C& lhs, const C& rhs)
{
   return lhs.compare(rhs) > 0;
}

bool operator<=(const C& lhs, const C& rhs)
{
   return lhs.compare(rhs) <= 0;
}

bool operator>=(const C& lhs, const C& rhs)
{
   return lhs.compare(rhs) >= 0;
}
Array operators

The array operator, or subscript operator, should always be defined as both a const and a non-const version. This operator can be found at both the left and the right side of an assignment.

When you need code for:

C c;
c[5] = 8;

The following operator should be implemented

c& C::operator[](int position)

{

return m_data[position];

}

However, when you only need to read out the value,

C c;

X = c[5];

The following operator pattern should be used:

const C& C::operator[](int position) const
{
   return m_data[position];
}

Conversion operators

class Rational
{ 
   public:
   Rational(int num=0,int denom=1);
   operator double() const
   {
      return double(num)/double(denom);
   }
}

Conversion operators are very often a problem, because they are often being called implicitly, and often when you don’t want them to be called. They are especially deadly in combination with a one argument non-explicit constructor for the same type. The result from implementing conversion operators is often that the programmer must explicitly cast and jump through hoops to get the wanted behaviour, so most times it’s better to just make a member function that returns the required representation. Note also that the example above don’t check for a possible zero value of denom. This might be handled by the runtime system by throwing a division-by-zero exception, at least for Win32.

Tip: Observe that the conversion operator does not declare a return type, much like a constructor.[SE1]

A special case for the conversion operator is if you want the object to signify if it is in a good or bad state for use in f.e. Boolean statements. To implement this as an operator bool conversion would seem the obvious way to implement this but it should rather be implemented like the below:

class C {
   public:
   operator const void*() const
   {
      return this->valid() ? this : 0
   }
   ....
};

If this had been implemented as a bool conversion operator the result could be used in other constructs than checking the objects state. The code above can only be used for checking the validity of the object by comparing the result to 0. [4]

Miscellaneous operators

Streaming operators

You should at least implement the put to operator (“<<”) for your classes, as it at the least is very helpful for printing debug messages.

Stream out
friend ostream& operator<<(ostream& out, const C& c)
{
   out << c.m_n1 << c.m_n2; 
   return out;
}
Stream in
friend istream& operator>>(istream& in, C& c)
{
   in >> c.m_n1 >> c.m_n2;
   return in;
}

These two operators should be declared friend of the class they work on if they need access to the representation of the object, parameter C above.

Streaming a class hierarchy:

Define a virtual function print in the base class of the hierarchy:

class Base {
   public:
   virtual ostream& print(ostream& os) = 0;
   ....
};

Implement the ostream operator in terms of the print member function

ostream& operator<<(ostream& os, const Base& object)
{
   return object.print(os);
}

It does not seem particularly useful to implement a similar scheme for the get from operator.

Dereference and member selection operator

The dereference and member selection operators are typically used to implement classes whose instances behave like pointers.

class Obj {
   public:
   void doIt();
   .....
};

class PtrToObj 
{
   private:
   Obj* pObj;
   public:
   ........
   Obj& operator*()
   {
      return *pObj;
   }
   Obj* operator->()
   {
      return pObj;
   }
}; 

This enables clients to use an instance of PtrToObj like it actually was an Obj pointer.

Obj* pObj = new ......

PtrToObj p(pObj);

p->doIt();

(*p).doIt();

Be aware that there are many ways in which to implement so called smart pointers, some are designed to be passed by value (value objects), where you write the copy constructor, assignment operator and destructor for the smart pointer to cater for features such as ownership transfer and reference counting. Another way is to disallow copying, and rely on passing by reference down the stack. See the article by B. Milewski in the references, for details of design and use of smart pointers.

You need to implement the const versions if you are going to pass the Ptr object by const reference. Like this:

void func(const PtrToObj& ptr)
{
   ptr->doIt(); // compile error if the const version of Ptr::operator-> is not defined.
}

Here are the implementations of the const versions of the dereferencing operators:

class PtrToObj
{
   ……..
   const Obj& operator*() const
   {
      return *m_pObj;
   }
   const Obj* operator->() const
   {
      return m_pObj;
   }
   ……
};

AddressOf operator

Also sometimes used with a smart pointer, implemented like this:

class PtrToObj 
{
   public:
   Obj** operator&()
   {
      return &m_pObj;
   }
   .....
}; 

Be aware that overloading the address operator breaks the identity check in the assignment operator (operator=). This may or may not be a problem.

Overriding the AddressOf operator is generally not seen as a good idea.

FunctionCall operator

This operator becomes very useful when extending/using the STL library, because the STL algorithms often take a function like object as a parameter. If you implement your custom function like object as a Class (a so called functor), instead of a function you can save and/or accumulate state through out the algorithm.

class C 
{
   public:
   void operator()(int, int);
   .....
}; 

Operators &&, ||, and ,

We have NO patterns for these operators since you should not overload them. See Scott Meyer (ref 2) item 7 for an explanation.

Conclusion

This article has laid out a series of operator patterns. By using these you can eliminate some of the most common bugs occurring with operators, and perhaps more important, you have one place to look for the patterns! Which is the reason we wrote it in the first case.

References:

The C++ Programming Language, 4th ed. Bjarne Stroustrup, 1997, Addison-Wesley

Exceptional C++, Herb Sutter, , 2000, Addison-Wesley

Effective C++ , Scott Meyer, 2nd ed. 1997, Addison- Wesley

More Effective C++, Scott Meyer, 1996, Addison-Wesley

Online:  C++ FAQs  or Book M.P. Cline and G.A. Lomow, 1998, Addison-Wesley

The ANSI/ISO C++ Professional Programmers Handbook, Danny Kalev, 1999, QUE

Large Scale C++ Software Design, Lakos, 1996, Addison-Wesley

Resource Management, Bartosz Milewski, http://www.relisoft.com/resource/resmain.html

Terje Sandstrøm is Senior Software Architect at Osiris Data AS. He has a M.Sc. in physics from the University of Oslo, and has been working with programming and program design since 1980, in a variety of languages, but C++ is still the favourite.

(2013 : Currently at Inmeta Consulting AS ,  for updated information on Terje , see http://about.me/Terjes)

Syver Enstad is a Software Developer at Osiris Data As. He has a B.Sc in computer Science from the University of Trondheim, and has been working with programming since 1998. He enjoys both C++ and C#, he also enjoys programming in Python and Smalltalk.

(2013 : Currently programmer at Tandberg ASA)


[1] Ok, ok, not exactly an operator, but it is part of the B3L, and is implemented in terms of op=, thus we add it here.

[2] As long as the assignment operator is implemented directly

[3] Before 1996 a named object would not be eligible for return value optimisation but after that date, the standard declares that both named and unnamed objects are eligible and newer compilers should do this optimisation.

[4] Lakos, page 649-650.


[SE1] This true under Win32, but not necessarily for C++ as such.


Saturday, December 14, 2013 #


Go to Part 1 – List of Product Updates for information on Visual Studio and TFS 2013 updates

Looking for the VS 2012 product updates and extensions ?  Go to Visual Studio 2012 Product and updates (Part 1)  and Visual Studio 2012 extensions (Part 2)

Looking for the VS 2010 extensions ? Go to Visual Studio 2010 - List of Product Updates (Part 1) + Extensions (Part 2).

Looking for links to the test adapters, go to this blog post.

Update Sep 19th 2014:  Updated ReSharper3 , NDepend3 ,  LinqPadTFS Team Project Manager,    Code Contracts1

See earlier update notes

This post is a list of the extensions I recommend for use with Visual Studio 2013. It’s coming up all the time – what to install, where are the download sites, last version, etc etc, and thus I thought it better to post it here and keep it updated. The basics are Visual Studio 2013 connected to a Team Foundation Server 2013, although most also works with earlier versions. 

Many live in a side-by-side environment with Visual Studio 2010 and 2012. The side-by-side is supported by VS 2013. However, if you installed a component supporting VS2013 before you installed VS2013, then you need to reinstall it. (Components marked with Note 3 below) The VSIX installer will understand that it is to apply those only for VS2013, and will not touch – nor remove – the same for VS2010 and VS 2012. A good example here is the Power Commands.

The list is more or less in priority order.

The focus is to get a setup which can be used for a complete coding experience for the whole ALM process.

The list of course reflects what I use for my work , so it is by no means complete, and for some of the tools there are equally useful alternatives. 

The components directly associated with Visual Studio from Microsoft should be common, see the Microsoft column.

For components that are updated through the gallery, I will no longer update the latest version numbers, as they are easily controlled through the Tools/Extensions and Updates dialogue. In the version column I will just write Auto.

If you want to use the same set of extensions on multiple computers, you might like to share them easily. Lars Wilhelmsen has a great blog post about how to use Dropbox to share extensions and common settings.

Extensions ready for VS 2013, both upgrades and new ones

ProductNotesLatest VersionLicenseApplicable toMicrosoft
File NestingAwesome and convenientAutoFreeVisual StudioMSFT
AutoHistoryAwesome, local historyAutoFreeVisual StudioMS Devlabs
EF Power Tools Beta 41See blog postAutoFreeVisual StudioYes
MyHistory1See MSDN ArticleAutoFreeTFS IntegrationNo
Inmeta AssociateRecentWorkItems1Fast way to associate recent work items to a checkin, reduce need to search around.  See Jakobs blogpost for more infoAutoFreeTFS IntegrationNo

Unit Test Generator1

Get back the ability to generate unit tests from code, also works for NUnit and XUnit.AutoFreeUnit Testing (VS)ALM Rangers
Codelens Code Health Indicator  12Awesome !  See this post (Norwegian), and this and this.AutoFreeCoding & QualityYes
Runsettings1Item template to create default runsettings fileAutoFreeUnit Testing (VS & TFS)No
TypeScriptSee info here, and B.Harry’s blogpost. Codeplex here 
Release notes 
Now part of VS 2013, installs with that  
See http://www.typescriptlang.org/
1.0FreeCodingYes
ReSharper3Note:Version 8.1.23.546 and earlier have an issue with Nuget/NUnit/Chutzpah, see here.  Download version 8.2 to get this resolved. 
Version 8.2.1 have an issue with nuget, see this post  
8.2.2000.5120LicensedCoding & QualityNo
NuGet Manager   3New initial install included with VS 2013. Updates through extension galleryAutoFreeVisual StudioYes
TFS Power Tools 
See Brian Harry’s blog post for more info 

12.1.00402.0FreeTFS integrationYes
NDepend3Info on updates here. Trial available.

5.4.1.8430

LicensedQualityNo
Build Manager1Community Build Manager. Info here from JakobAutoFreeTFS IntegrationNo
Visual Studio 2013 SDKRequired for using WixPublished 11.Oct.2013FreeVisual StudioYes
Wix Toolset3.8FreeCoding/InstallersNo
Productivity Power Tools1Awesome package. A must have!AutoFreeVisual StudioYes
Code Contracts3Now on gallery too. Info here and follow the forum here 
See new blog here
1.7.10908.11FreeCodingYes
Code Contract Editor Extensions1 1.5.60813.10FreeCodingYes
Visualization and Modeling SDKRequires VS 2013 SDK 
Nov 10th 2013Free now, otherwise Part of MSDN SubscriptionModeling, DSL, UML extensionsYes
Slow Cheetah1 3Tool for transforming XML files, like config files.AutoFreeCodingNo
Web Essentials1AutoFreeCodingYes
Devart T4 editorNice T4 editor, using this now instead of tangible.AutoFreeCoding (T4 templates)No
tangible T4 editor1Lite version is free and more than enough for T4 editing.2.2.3Lite version Free (Good enough)Coding (T4 templates)No
ASP.Net and Web Tools 2013FreeCodingYes

#1 Get via Visual Studio’s Tools | Extension Manager (or The Code Gallery). (From Adam : All these are auto updated by the Extension Manager in Visual Studio)

#2 Works with ultimate only

#3 Also works with VS 2010 and VS 2012

 

Tools (outside Visual Studio)

ProductNotesLatest VersionLicenseApplicable toMicrosoft
ILSpyDecompiler –open source. Can also export assembly as C# project2.2.0.1706FreeCoding/InvestigationNo
DotPeekDecompiler from Jetbrains. Can also export as C# project1.2.1.226FreeCoding/InvestigationNo
LinqPadInfo here4.51.03Free and licensed versionsCodingNo
      
TFS Team Project ManagerExtremely valuable. Handle maintenance of work items, process, and much more across multiple team projects at once.  No more batch files with witadmin! See it at Codeplex 1.7.5119FreeTFSNo
TFS Administration ToolHandling security and permissions in TFS, Sharepoint and reporting services. Open source tool at Codeplex 
Version 2.3 is fully 2013 compatible. If you don’t have VS installed, download and install the TFS 2013 Object model 
Version 2.2 works on 2013 but requires the 2012 Object model to be installed.
2.3FreeTFSNo

 

Extensions we wait for, not yet in a VS 2013 version

ProductNotesLatest VersionLicenseApplicable toMicrosoft
Inmeta Build Explorer  FreeTFS integrationNo