Syndication

News

     

Archives

Miscelaneous

Programming

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:

OutDir:
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.

OutputPath:
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....

Read full article

Posted by Daniel Cazzulino
Filed under:

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, ...

Read full article

Posted by Daniel Cazzulino
Filed under:

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...

Read full article

Posted by Daniel Cazzulino

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 http://archive.msdn.microsoft.com/vsvmsdk 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):...

Read full article

Posted by Daniel Cazzulino

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:

image

 

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>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>

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:...

Read full article

Posted by Daniel Cazzulino

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....

Read full article

Posted by Daniel Cazzulino
Filed under:

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....

Read full article

Posted by Daniel Cazzulino
Filed under:

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. ...

Read full article

Posted by Daniel Cazzulino
Filed under:

Go straight to the site if you want: http://nudoq.org. 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 NuGet.org 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 ...

Read full article

Posted by Daniel Cazzulino
Filed under:

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  ...

Read full article

Posted by Daniel Cazzulino
Filed under:
More Posts Next page »