Subscribe: Daniel Cazzulino's Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
article  full article  full  new  nuget  open source  open  packages  project  read full  read  studio  visual studio  visual 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Daniel Cazzulino's Blog

Daniel Cazzulino's Blog


OutDir vs OutputPath

Tue, 28 Jan 2014 04:25:46 GMT

Which one should you use? Seems like OutputPath is the way to go, since it’s the one that is specified on every project you create, right inside the Debug or Release configuration.

From C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets, however, we learn:

Indicates the final output location for the project or solution. When building a solution,
OutDir can be used to gather multiple project outputs in one location. In addition,
OutDir is included in AssemblySearchPaths used for resolving references.

This property is usually specified in the project file and is used to initialize OutDir.
OutDir and OutputPath are distinguished for legacy reasons, and OutDir should be used if at all possible.

Sometimes the best way to understand MSBuild is to dig deeper in the built-in targets. They are pretty well self-documented....(image)

Read full article

Smarter Visual Studio Template Authoring

Mon, 27 Jan 2014 21:54:19 GMT

From Clarius VisualStudio Targets project:

The out of the box experience for authoring templates in Visual Studio is a multi-step process that isn't very amenable to incremental improvements. An exported .zip file does not encourage rapid iteration ;).

An alternative way introduced in VS2010 was a new project template.aspx) to generate a project (or item) template output (its compressed zip). Yup, if that sounds weird, it's because it is. It's a project where you don't compile anything, but rather just work with the files with parameter substitutions.aspx) and the like, and where building means just zipping it. If you have just one template to distribute with your VSIX, that may be ok.

For more advanced scenarios, where reusing shared artifacts (i.e. same AssemblyInfo.cs, shared images, etc.) and having a faster build cycle is needed, ...(image)

Read full article

Complex traces you can actually understand by leveraging Activity Tracing

Tue, 14 Jan 2014 16:13:30 GMT

Activity tracing is part of a feature that was initially introduced with WCF, named End-to-End Tracing. Its underlying implementation, however, is baked into the XmlWriterTraceListener and does not depend on WCF in any way. Currently it's only supported in the SystemDiagnostics implementation.

So what is activity tracing? It can be summarized as:

Activity tracing are special traces that record the processing flow across threads, processes and even machines, allowing for later correlation

The activities are identified by an arbitrary guid, which is placed in the ambient singleton property Trace.CorrelationManager.ActivityId. This ID flows with threads, and in the case of WCF, you can make it flow across processes and machines. This ID must be logged somehow, however, to be picked by a tool that can correlate the traces. For that purpose, this ID is tracked via...(image)

Read full article

How to transform T4 templates on build without installing a Visual Studio SDK

Mon, 13 Jan 2014 20:26:50 GMT

The MS recommended way is to just use the Microsoft.TextTemplating.targets which come with the Visual Studio Visualization and Modeling SDK. It makes me slightly nervous that it requires a little known SDK that is hosted on rather than something more “official” like the MSDN Download Center, where the proper VS SDK lives. It also turns out to be absolutely unnecessary, since all you need is already installed with your base Visual Studio setup.


Visual Studio installs the TextTransform.exe utility,  which can use used to transform a template automatically. Ideally, you shouldn’t have to do anything different than you do today when using text templates, and the automatic build-time transform should “just happen”. One way to achieve this is by grabbing all the files that have one of the T4 custom tools assigned (they are always assigned them when you create a new text template in VS):...(image)

Read full article

How to create a Visual Studio extensibility project that is compatible with VS 2010, 2012 and 2013

Sat, 11 Jan 2014 16:52:47 GMT

For most common project types, you can just create a project in VS2010 and open it in 2012 and 2013 just fine. For some others (like VS package or VSIX projects), you may find Visual Studio wants to perform a one-way conversion:



The first check that was introduced with VS2012 was to require a new $(MinimumVisualStudioVersion) property that has to match the also newly introduced $(VisualStudioVersion). The one-way upgrade would end up introducing the following two properties at different places in the project file:

<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>

The next was to improve the way the location of the VSSDK is determined (to allow overriding it on build servers, I assume). Where previously you’d have a hardcoded reference to the VSSDK targets:...(image)

Read full article

Extending Visual Studio: Good Test Coverage Is Possible

Mon, 02 Dec 2013 15:02:53 GMT

A World of Pain?

It's not quite uncommon to see developers despair when doing Visual Studio Extensibility (VSX) work. In addition to a myriad new APIs to learn (which can be pretty intimidating), it seems up-front so alien to the typical development work you do: you have to plug into someone else's environment, you have to learn when and why your code will be invoked, but worst of all, there's no plug-in architecture per-se.

Unlike other frameworks that implement certain patterns (i.e. ASP.NET MVC, WPF MVVM) or "plain" apps/services where you decide more or less up-front what pattern you'll apply (DDD, Active Record, SOA, etc.), doing VSX feels more like doing transaction scripts over the VS APIs: hook to an event or implement a callback, and when called, go off do your thing and be done. And more often than not, cleaning up the mess is done by trying to apply DRY (dont repeat yourself) by moving repeated code over to all sorts of helpers or extension methods. I'm as gilty as anyone of having created yet another DteHelper.cs in the past....(image)

Read full article

How to install a Visual Studio extension with templates via an MSI

Wed, 13 Nov 2013 20:20:59 GMT

The original story around VSIX deployment via an MSI was that simply copying it to the %VSInstallDir%\Common7\Ide\Extensions\Your Company\Your Product\Version was enough. But alas, devil is in the details, and a fairly complex matrix of supported and unsupported features depending on the deployment style is also available on MSDN.

However, whenever templates are involved, the general advise from Microsoft was to just run devenv /setup at the end of your MSI installation. This might have been fine when you were only targeting VS2010, but now with 2010, 2012 and 2013 potentially installed on the machine, running devenv /setup three times in a row can take a LOOONG time (we’re talking several minutes here). And this was unavoidable if you are deploying your templates to Common7\IDE\ProjectTemplates or Common7\IDE\ItemTemplates....(image)

Read full article

High level overview of Visual Studio Extensibility APIs

Fri, 25 Oct 2013 15:45:45 GMT

If your head is dizzy with the myriad VS services and APIs, from EnvDTE to Shell.Interop, this should clarify a couple things.

First a bit of background:

APIs on EnvDTE (DTE for short, since that’s the entry point service you request from the environment) was originally an API intended to be used by macros. It’s also called the automation API. Most of the time, this is a simplified API that is easier to work with, but which doesn’t expose 100% of what VS is capable of doing. It’s also kind of the “rookie” way of doing VS extensibility (VSX for short), since most hardcore VSX devs sooner or later realize that they need to make the leap to the “serious” APIs.

The “real” VSX APIs virtually always start with IVs, make heavy use of uint, ref/out parameters and HResults. These are the APIs that have been evolving for years and years, and there is a lot of COM baggage. ...(image)

Read full article

Improving the state of the art in API documentation sites

Tue, 15 Oct 2013 19:07:41 GMT

Go straight to the site if you want: You can then come back and continue reading :)

Compare some of the most popular NuGet packages API documentation sites:

You see the pattern? Huge navigation tree views, static content with no comments/community content, very hard (if not impossible) to search/filter, etc.

These are the product of automated tools that have been developed years ago, in a time where CHM help files were common and even expected from libraries. Nowadays, most of the top packages in don’t even provide an online documentation site at all: it’s such a hassle for such a crappy user experience in the end!

Good news is that it doesn’t have to be that way.

Introducing NuDoq

A lot has changed since those early days of .NET. We now have NuGet packages and the awesome channel that is ...(image)

Read full article

Contributing to OSS projects made easy

Tue, 20 Aug 2013 22:32:15 GMT

I recently came across what I believe is a missing feature (bug?) in Json.NET most excellent library: when using custom constructor, default values are not populated for properties :(

Being open source, I just went to its GitHub project, created the mentioned Issue, and proceeded to fork the repo.

Immediately after getting the source and opening the VS solution, I noticed it used different settings than my default ones, i.e. it uses two whitespace “tabs”. That’s typically the first barrier to contributing: am I supposed to now go to the project website, read some coding standards page, change my VS settings to match, just to start coding?

Luckily, I also noticed alongside the solution, the Newtonsoft.Json.vssettings file. Now that’s useful! Not only that, but by being named the same as the solution file (just changing the file extension), it’s automatically picked up by the  ...(image)

Read full article

How To Temporarily Disable The Touch Screen In X1 Carbon

Thu, 01 Aug 2013 14:27:12 GMT

I know, why would anyone want to do that?

Scott properly predicted:

Don't knock a touchscreen until you've used one. Every laptop should (and will) have a touch screen in a year. Mark my words.

And surely, less than a year later, the X1 Carbon (an amazing ultrabook for sure) has a touch model. And as of today, the price difference for the touch screen is a ridiculous $30 (actually $24 with a “back to school” coupon right now ;)):


So why would you NOT get it?

I know for some it works great. Now, let’s get real about touch *for a developer* for a minute. About 99.9% of my time in front of my laptop I’m either using Visual Studio or Chrome. I have my hands on the keyboard ALL THE TIME. I use the trackpoint ALL THE TIME. If I want to scroll, I only have to slightly move my fingers. I don’t click around much on pages: I READ them. So, in a few months of using the X1, I think I touched the screen like 10 times, and it was mostly to clear dust, which drives whatever app is in focus crazy. Plus, at home I have this simple setup:...(image)

Read full article

PayPal Samples are virtually useless

Tue, 30 Jul 2013 16:06:42 GMT

I’m investigating the PayPal Adaptive Payments for a project, and was gladly surprised to find not only the sample app but also the SDK itself open sourced at GitHub. Cool!

My excitement ended abruptly as I opened the sample app. It’s so unbelievably bad you have to see it to believe it. A few WTFs:

  1. Sample is essentially a bunch of .aspx pages with plain forms that allow you to fill all possible parameters
  2. Form uses postback to a **1600+** lines of code .ashx handler that uses the submit **BUTTON TEXT** to determine the operation to perform
  3. Then the handler goes on to manually parse the HttpContext.Request.Params collection one by one and building the PayPal API classes used in the requests/services


How does web apps this way these days?? Being a C# sample, I would have expected at least to have an MVC app, that potentially used nice model binders to automatically parse form input and invoke PayPal from that, and fill an EF code first database with the IPN callback data, etc....(image)

Read full article

How to fix continuous deployment error for .NET 4.5 in Team Foundation Service

Sat, 20 Jul 2013 21:01:05 GMT

If you’re configuring continuous deployment on Team Foundation Service for a .NET 4.5, you may get an error like the following in the build log:

Exception Message: The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v4.0'. This application requires 'v4.5'.
  Learn more at: (type DeploymentDetailedException)

I don’t recall exactly where (may have been here), but the solution is to simply add the following property to the project file:


Read full article

A new way of financing open source software via Kickstarter

Wed, 10 Jul 2013 04:50:47 GMT

The Kickstarter successes of the ambitious Ghost as well as the much more modest Schema Migrations for Django or git-annex (all open source software projects) got me thinking that this could be the start of a new way to fund open source projects in general.

The Django project in particular was solely to add a significant feature to an existing open source project. What if popular open source projects started creating Kickstarter projects to raise funds to push the projects forward? Say a major significant rewrite is needed in some area but nobody can afford a 2 week break from work  to complete it? Maybe it requires more than one dev? Maybe devs are from different parts of the world and if significant funds are raised, they could even afford to travel and work together on-site somewhere for 2-3 weeks?...(image)

Read full article

Why Visual T4 is the greatest T4 editor in the world

Fri, 05 Jul 2013 19:57:57 GMT

Unlike every other T4 editor out there, Clarius Visual T4 is the only one to embed the actual C# editor inside the T4 code blocks. This may seem like irrelevant implementation detail to some, but let me show you why it’s not. First, your language settings are fully honored, and not just because we read them and use them for our own editor (like other editors may do), but because it’s the built-in C# editor doing the work! Tooltips as usual in C#: Intellisense on APIs as usual in C#: Parameter info as usual in C# code :) Pretty good indenting! Full support for VERY complex includes! (the EF one has 2200+ lines) Full T4 directives intellisense with tooltips, as you’d expect: Can add arbitrary assemblies an get their intellisense too: Can build any LINQ query you fancy with full intellisense: Use your favorite code snippets as usual in C#:...Read full article[...]

How to tweet automatically when you push a new package to

Mon, 17 Jun 2013 17:59:35 GMT

Wouldn’t it be nice if your followers could be notified whenever you publish a new version of a NuGet package? Currently, offers no support for this, but with the following tricks, you can get it working without programming.

The essential idea is to use the OData feed that exposes to build an RSS feed with new items as you publish them, and have IFTTT do the tweeting from it.

The tools we’ll use to get this working are:

  1. LinqPad: to examine the OData feed at 
  2. Yahoo Pipes: to tweak the OData feed output so that it looks like a “plain” feed
  3. IFTTT: to consume the pipe output and auto-tweet on new items


Exploring NuGet OData Feed with LinqPad

In order to build the query that will become your tweets’ source, we will add a new connection in LinqPad by clicking on the “Add Connection” link:...(image)

Read full article

NuDoc: A .NET XML API Documentation Reader

Tue, 11 Jun 2013 20:11:36 GMT

A couple days ago I was toying with the idea of generating a static API documentation site in markdown ready for hosting in GitHub. The idea is to make it part of the project wiki, so that anyone can very easily improve the code documentation, and later on somehow allow project authors/contributors to merge back the edited markdown as XML documentation in the code itself, so that the cycle is closed.

So I set out to spike the idea, and the first thing I encountered was that reading XML documentation was something that you either had to do by just using XML APIs in .NET, or you had to use some big piece of software that not only reads documentation but it also can generate an entire site already, in multiple formats with plugins and formatters and what-not. There was no middle ground.

So, instead of building my XML doc <-> markdown wiki synchronizer, I first had to build a simple XML documentation reading  API :). Straight from the NuDoc site:...(image)

Read full article

Automatic component registrations in Autofac

Wed, 05 Jun 2013 21:34:52 GMT

I just had to adapt my favorite IoC container to do some of the things MEF does out of the box, namely registering all classes that have a certain attribute (in MEF’s case, [Export]).

This is very easy with Autofac. I first created the attribute that would mark my “components” for registration (aka “exports”):

/// <summary>
/// Marks the decorated class as a component that will be available from 
/// the service locator / component container.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class ComponentAttribute : Attribute
    /// <summary>
    /// Initializes a new instance of the <see cref="ComponentAttribute"/> class, 
    /// marking the decorated class as a component that will be available from 
    /// the service locator / component container, registered with all 
    /// implemented interfaces as well as the concrete type.
    /// </summary>
    public ComponentAttribute()

    /// <summary>
    /// Initializes a new instance of the <see cref="ComponentAttribute"/> class, 
    /// marking the decorated class as a component that will be available from 
    /// the service locator / component container using the specified 
    /// <paramref name="registerAs"/> type.
    /// </summary>
    /// <param name="registerAs">The type to use to register the decorated component.</param>
    public ComponentAttribute(Type registerAs)
        this.RegisterAs = registerAs;

    /// <summary>
    /// Type to use for the component registration.
    /// </summary>
    public Type RegisterAs { get; private set; }

Read full article

Increase developer productivity with NuGet packages with NuGet References

Wed, 05 Jun 2013 20:35:49 GMT

A typical solution usually has many projects, and many more NuGet packages in use:



How do you get a glance of what packages are installed on each project? Typically, you’d just open each of the packages.config XML files, or worse, go to the “Manage NuGet Packages…” dialog:




Which brings up a pretty daunting dialog:




If you wanted to uninstall a particular package, you could alternatively just type in the package manager console, but many developers aren’t as familiar with the available commands, or simply prefer to work in a more visual way. What if you could just expand the packages.config node, find the package you want to uninstall and click a context menu to do so?




That’s precisely what the NuGet References extension provides. All packages.config nodes in the solution explorer can now be expanded and all installed packages inspected. Not only can you directly update or uninstall the extension right from the solution explorer, but you can also search a given package to see which projects use it and may need updates!...(image)

Read full article

NuGet References: publishing my first open source extension to the DevStore

Sat, 18 May 2013 22:51:32 GMT

Last week I had the pleasure of spending time with a bunch of friends at the OuterConf 2013, including pretty much the entire NuGet team. I also could attend to the hackathon they organized, and I got to hack what I think is a pretty cool Visual Studio 2012 extension: NuGet References.

An improved NuGet experience

The idea is simple enough: I wanted to leverage some new extensibility hooks in VS2012 to show installed nuget packages right inside a packages.config file, like so:


And once you have the nodes in there, wouldn’t it be cool to be able to update and uninstall right from there?


And why not allow me to see key information about the package on the properties window?


Cool enough (image)

Monetizing your creations

Now, after the extension was “done” (there’s a TON more that can be added to it! This is just the start), I realized I had put quite a few hours (more like days by now!) into it. So even if I do want my work to be open source so that eventually it can make it into NuGet’s core tooling, I could certainly use a few bucks to pay for the coffee and beer I put into it ...(image)

Read full article