View stack trace for visual studio sharepoint deployment by enable diagnostics logging for SharePoint projects


I have a problem in visual studio SharePoint projects deployment that when an error occurred there is no stack trace enabled that i can see the details of the error like that

VS Deployment Exception

So i found a solution to enable stack trace for SharePoint projects in visual studio by adding a registry key to enable diagnostics logging for SharePoint projects

  1. Open registry  editor  by open start up menu – > type run -> type regedit then click ok
  2. Create a DWORD key type , the name is “EnableDiagnostics” and value “00000001” under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SharePointTools      “the “10.0” folder for visual studio 2010 and you can do the same in your visual studio version

enable diagnostics logging for SharePoint projects

  1. Restart the operating system
  2. Now i can see the details of deployment in the visual studio output window as image below and in which step it fails.

Visual Studio SharePoint Deployment Exception Stack Trace

Hope it will help.


Visual studio wsp deployment Error occurred in deployment step ‘Add Solution’: Value cannot be null


Sometimes when you try to deploy your SharePoint solution from visual studio an error occurred

visual studio wsp deployment Error occurred in deployment step ‘Add Solution’: Value cannot be null

The error comes because you opened “Elements.xml” in visual studio IDE when you deploy the solution ! it fails when the “FindConflicts()” method invoked during add solution step in visual studio deployment.

Two solutions to solve that :

  1. Simply close any “Elements.xml” file opened in visual studio IDE then deploy it will success 😀
  2. Change deployment conflict resolution for your module from Automatic “the default value” to None – image below

deployment conflict resolution

That’s it !  🙂

Set HTML attrbuites from SharePoint content type fields in page layouts


The Problem / Example : Need to put the “alt” attribute in the HTML “img” element from a content type field “Title” in a custom page layout and the content type fields represented as a SharePoint controls like that

SharePoint Field Value Control

You can do that simply by CSS/ JQuery :

1-Hide the SharePoint control that represent the field value using CSS and give the span container an ID “Ex: spanTitle” :

Hide SharePoint Field Value

2-Write the HTML “img” element with attribute “alt” empty and give it an id “Ex:exampleImage”  :

HTML img element3-Write these lines of JQuery that will fetch the value from the hidden span and put it to the “alt” attrbuite in the “img” element :
Fetch SharePoint Control Value And pass it to HTML attrbuite

Thanks !