Deployment error: failed to load due to invalid xml: Name cannot begin with ‘%’

The situation when I come across this error is during the deployment and activation of a master page. The problem is that I added the .masterpage file as an element manifest rather than an element file in the Feature.xml definition that deploys the master page to a site collection.

The solution:

Add the .masterpage file as an element file not as a element manifest in the Feature.xml definition!

Visual Studio 2010 Can’t open new SPSite object

Using Visual Studio 2010, I come across an FileNotFoundException when creating a WPF application. The exception happened with the below snip of code:

using(SPSite¬† site = new SPSite(“http://phillau”))

I read another post that told me to run Visual Studio 2010 with Administrator privileges so I did. It did not fix the problem.

So I went into the csproj properties and checked out what platform my project was targeted at. I changed it from x86 to x64 because I was working in a x64bit environment. Then I came across a PlatformNotSupportedException.

I went into the csproj properties again and changed the .Net version from 4 to 3.5. .Net 4 has not been deployed to in my work environment.

Rebuilt the project and SUCCESS ūüôā


  1. OS: Windows Server 2008 R2
  2. SharePoint 2010
  3. Visual Studio 2010

The “Exec” task needs a command to execute

I received this error while attempting to build a Visual Studio project

The “Exec” task needs a command to execute


I removed all empty spaces and empty lines from the pre and post build scripts

Intellisense not working with master page in Visual Studio 2010

Intellisense was not working while I was trying to create a new master page in Visual Studio 2010 for a SharePoint 2010 site definition.

The solution:

Go to Solution Explorer -> Select the .masterpage file and right click (or left depending on your mouse configuration)¬†-> Select Open With… ->Select Master Page Editor (Default) from the list.

Click Ok

Intellisense should be availble now.

Cannot start service SPUserCodeV4 on computer

While I was attempting to retract my SharePoint 2010 site definition from the farm solutions store, I encountered the following error

Cannot start service SPUserCodeV4 on computer …

This is how I fixed it:

Go to Central Administration -> System Settings -> Under Servers, select Manage services on server

Locate Microsoft SharePoint Foundation Sandboxed Code Service -> Press Start

Go back to Visual Studio 2010 and try again.


Where is Guidgen in Windows Server 2008?

In Windows Server 2008 with Visual Studio 2010 installed, Guidgen is located at:

c:\ Program Files (x86)\Microsoft SDKs\ Windows\ v7.0A \BIN

The assumption is c:\ is the main drive. Change this if this is not the case.

Visual Studio 2010 loses Microsoft.SharePoint.dll reference

I was creating a console application to do some querying on a SharePoint site using Visual Studio 2010. I added the Microsoft.SharePoint.dll assembly from the ISAPI folder from the 14 Hive and I proceeded to code. When I came to compiling the code, I got some errors in the Error List. From the description of the errors, they were telling me that the Microsoft.SharePoint.dll assembly is a missing reference. I am sure I added the assembly into the references folder because the assembly is still there !

Anyways, to solve this problem, I did the following:

In Visual Studio 2010, go to Solution Explorer -> Right (or left depending on mouse configuration) click on the project, select Properties. In the Application tab, change the Target Framework from either:

.NET Framework 3.5 Client Profile to .NET Framework 3.5


.NET Framework 4.0 Client Profile -> .NET Framework 4.0