SharePoint field definition: DisplaceOnUpgrade="TRUE"

When coding SharePoint features to deploy fields and content types, a common problem is that when upgrading the solution, fields are not upgraded too.

The reason is that each field definitions should contain the following line:


In this way, when upgrading the solution, even if the field is already found, it is upgraded.


To upgrade content types, adding or removing fields, SharePoint 2010 introduced the concept of UpgradeActions, as described in my other blog post SharePoint 2010: feature upgrading.

SharePoint: choosing between Custom Web Templates and Custom Site Definitions

SharePoint 2010 introduces the concept Web Templates of SharePoint 2010, that should take over the Site Definitions.

In the article Deciding Between Custom Web Templates and Custom Site Definitions it is described that:

  • the prefered approach is to use now Custom Web Templates instead of Custom Site Definitions;
  • there are a few exceptions when Custom Site Definitions have still to be used.


Advantages of Custom Web Templates are:

  • They can be modified without affecting existing sites, while Site Definitions are immutable to maintaining them requires to create new and updated versions, and instruct the users to use the latest version... (not very user friendly);
  • They can be deployed in Sandboxed Solutions and SharePoint Apps too, while Site Definitions require farm solutions.
  • They are easier to upgrade with next versions of SharePoint

.NET client side debugging and profiling with Glimpse

Glimpse is a client side library for debugging and profiling, that you can install in your Visual Studio project with NuGet.

It is fully described in the following blog posts:


There are also extension to Entity Framework, to track database requests, and Elmah, already discussed in my other article .NET Health Monitoring with Elmah, that allows to add recorded exceptions in a new tab.


Finally, it's possible to develop custom tabs, described in this serie of articles:

SharePoint 2013: JavaScript Dispaly Templates

In SharePoint 2013, it is not necessary anymore to use XLST to customize ListView web parts.

In fact, JavaScript display templates have been introduced, allowing to develop customizations in JavaScript instead of XSLT: in this way, code is easier to develop and understand, other than debuggable.


Here are some links:

SharePoint 2013 and 2010: deploying pages with features and modules

After my previous article SharePoint 2007: how deploy pages and web parts via feature I have found a better way to deploy web part pages via features.


You can create a Module and use the following properties:

  • Path: it is about the source file included in the wsp
  • Url: it is about the destination file included in the SharePoint database

Both properties can be define both at Module level and at File level; if present at Module level, they are combined.


Each file is an aspx page that in traditional way contains multiple ContentPlaceHolder controls.


To include web parts:

.NET Health Monitoring with Elmah

Elmah (Error Logging Modules and Handlers for ASP.NET) is a Google library that you can find at its dedicated web site: Elmah - Error Logging Modules and Handlers for ASP.NET.

This library is used for Health Monitoring and allows to trace unhandled exceptions, logging them and, optionally, viewing them in a dedicated page.


This library is that it is implemented with a custom HttpModule, as described in the article Using HTTP Modules and Handlers to Create Pluggable ASP.NET Components.

In this way, the installation doesn't require any code recompilation, as it is enough to add copy DLLs to the bin folder and add some web.config entries.


Finally, the last article ELMAH (Error Logging Modules and Handlers) with SQL Server Compact explains how to install and configure ELMAH with the Local SQL.

Windows 8: how give Internet connection to Hyper-V machines

I'm currently studying MVC 3 and 4 on the Application Lifecycle Management for TFS 2012 virtual machine, on my client machine that runs Windows 8 with Hyper-V.

If you need to setup Hyper-V on Windows 8, I've followed the guide in the blog post Get started with Windows 8 Client Hyper-V the right way.


Once you run the virtual machine, you can see that it does not have Internet access. That is a problem if you use nuGet to download and update packages.

To solve this problem, I have followed the guide Using Your Windows 8 Wireless Connection Inside Hyper-V.


But even after having Internet access, I see that I can't download or update nuGet packages from online.

Again, luckly I have found the solution online, in the answer to the question Visual Studio 2010 nuget error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.