Feeds:
Posts
Comments

Archive for the ‘Tools’ Category

Sometimes it is a lot handier to just update one of the dll’s in the GAC rather than go through the pain of deploying an entire SharePoint solution. In fact it’s one of the key features that makes the CKSDEV Visual Studio plugin so valuable. Not best practice, to copy directly to the GAC, but very handy in a dev environment.

.NET 4.0 has a new gac location

Today, I wanted to quickly update a dll from a custom SharePoint solution. I was baffled when I could not find the dll in the assembly ( “c:\windows\assembly ” ) folder.

Turns out that starting from .NET 4.0 and up there is a new ‘GAC’ folder in town. It is now located in “c:\windows\microsoft.net\assembly“. You can simply browse to that directory with Windows Explorer and view all the folders.  The new GAC folder does not hide version information (=folders) anymore like the old one did.

assembly

They introduced this new folder to avoid issues between CLR 2.0 and CLR 4.0 , the GAC is now split into private GAC’s for each runtime.  The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC.

So keep in mind there are two folder now. One for .NET versions 2.0, 3.0, 3.5 and one for .NET versions 4.0 and up.

For more information on installing dlls in GAC
http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx

More information about the GAC
http://msdn.microsoft.com/en-us/magazine/dd727509.aspx

Read Full Post »

I use the Visual Studio CKSDEV plugin so much that I almost forgot it’s not standard Visual Studio functionality. It’s no doubt the number one tool when creating SharePoint solutions with Visual Studio.

Unfortunately the plugin is not yet updated for Visual Studio 2012 / SharePoint 2013.  But the people at Mavention have created a small tool that mimics the “Copy to GAC” functionality. So it takes at least some of the pain away.

Read all the details on Weldak’s blog:
http://blog.mastykarz.nl/quickly-deploying-sharepoint-2013-projects-mavention-quick-deploy/

Download the tool here:
Mavention Quick Deploy

Update:
As Gary pointed out in the comments below. There is a new kid in town called Fishbone. The reviews, functionality and screenshots look promising. Let’s find out!
http://visualstudiogallery.msdn.microsoft.com/4784e790-32f4-455f-9228-53f537c03787

Read Full Post »

Ran into this helpful tool on Codeplex today. The SharePoint language pack downloader (http://sp2010dl.codeplex.com)

Manually downloading all the needed language packs from the Microsoft site can be handful. You have to download an extra pack when you have the SharePoint Server version installed. Multiply the amount of packs by 2 if you have a service pack installed. And you have to do this for all the required languages.

This can be confusing and if you don’t pay attention it’s easy to make mistakes. Luckily this tool downloads all packs automatically. A real time saver.

Read Full Post »

Introduction

This topic might seem basic but I get the question quite often. How do you read logs?

Reading the log file.

The simplest way is opening the log files from the 14$\logs in Notepad. This might be quickest way but not the most efficient in a live multiuser environment. I usually use this in a development environment in combination with a text editor that automatically reloads the file when it’s updated (Notepad++).

Using powershell with a correlation id

You can use powershell to quickly track down a correlation ID and dump the related log files into a file

get-splogevent -starttime (get-date).addminutes(-20) | where-object { $_.correlation -eq “b66db71a-3257-4470-adf9-5c01dc59ecb3″ } | fl message > c:\errors.txt

More info can be found here :
http://www.mysharepointadventures.com/2011/08/175/

Uls viewer

A Windows application for viewing the ULS logs more easily. Very handy when you are (trying to) reproduce a specific error and during debugging
I use it when I’m trying to track down a specific error and during debugging.

http://ulsviewer.codeplex.com/

Farm solution

Codeplex also has a nice solution which you can query the SharePoint logs with from within Central Administration.
The solution installs in your Central Administration. Very handy if you want a quick look in your logs files without having to connect over remote desktop to the actual server.
For detailed log digging this tool might not be sufficient.

http://sp2010getcorrelation.codeplex.com/

Read Full Post »

Quick description

Application Tool Manager (APM) is a great utility when programming for SharePoint 2010 (and general (IIS) web development) . Very handy if you want to attach your debugger to a specific w3wp.exe Process ID (PID)

The description on their website

This freeware application is a System Tray utility for providing quick access to common IIS tasks which are useful on a SharePoint development box. It may also be useful to others working with IIS. In essence, it enumerates the app pools on your box and lets you right click ‘em to bounce ‘em!

You can download the tool here<: http://www.harbar.net/articles/apm.aspx

 

Read Full Post »

Here is a NLog config file that generates a similar log file layout as with the (default) Log4Net settings.

This NLog configuration also includes the date in the log file name to mimic the Log4Net ‘rollingFileAppender’ behavior.

file: NLog.config

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true">

  <targets>
    <target name="logfile" xsi:type="File" fileName="C:\Projects\logs\MainLog.${shortdate}.log" layout="${level:padding=-6}  ${threadid:padding=-4} ${processid}   ${longdate}  ${logger:shortName=true:padding=-24} ${message} ${exception:format=ToString,StackTrace}"/>
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="logfile" />
  </rules>

</nlog>

Read Full Post »

Good news!! JetBrains released the first version of their free decompiler tool, dotPeek.

Since the February 2011 the .NET community was looking forward for a new free decompiler tool after RedGate announced that their insanly popular decompiler tool ‘Reflector’ would no longer be free. Jetbrains reacted and is giving the .Net community: dotPeek.

DotPeek was already available with Resharper (beta) builds but now it’s also available as a standalone version!

Download the goodness here:
http://blogs.jetbrains.com/dotnet/2011/05/free-net-decompiler-is-available-for-early-access/

It’s free and supports .Net assemblies from version 1.0 to 4.0.

I’m a long time fan of JetBrains Resharper product. If the quality of dotPeek is equally good then RedGate Reflector will soon be forgotten. ;-)

Keep up the good work!!

Regards, W0ut

Read Full Post »

Introduction

Sometimes I prefer logging to a simple log file instead of using the Event Log, Tracing or the SharePoint Logs. The ability to turn on and off these logs without having to update a dll or web.config is a great advantage in SharePoint as well.

I was a fan of Log4net project but the project is no longer being actively supported. It hasn’t been for years. Due to this lack of maintenance it is now missing support for recent .NET Frameworks like the 4.0, the Compact framework, etc…

On top of this I regularly experienced problems with getting Log4net to work in a SharePoint environment. The most common behavior was that log files were created correctly but remained empty. No log lines were written to the files.

So time to change? Welcome NLog.

Basic principles

The basic principles with NLog are the same as with Log4Net

  • You reference the dll in your project
  • Declare a logger object in your class/function.
  • Call the logging functions
  • Configure the logging behavior by configuration files.

The config files

First positive experience. NLog is very clear where it expects the configuration files to be. This may seem trivial but in a complex website hosting scenario it can be a nightmare to determine the correct location of the Log4Net config files.

The following locations will be searched when executing your program:

  • in the web.config
  • web.nlog located in the same directory as web.config
  • NLog.config in application’s directory
  • NLog.dll.nlog in a directory where NLog.dll is located

For detailed information see the NLog documentationhttp://nlog-project.org/wiki/Configuration_file

The project setup

Using NLog is very simple. It’s actually exactly the same as with log4net.

  • Reference the dll in your project
  • Add a “using NLog” statement to your class
  • Create a logger object
  • Call the correct functions of the log object

Note: logging exceptions is a bit different in NLog. If you want to log an exception you have to call the ‘LogException’ function. You can not pass the exception object as a parameter to the default logging functions.

The config file

One minor issue is that the default log file layout is not as clear as with log4net.

But after reading some documentation I got my log files in almost the same look and feel as in Log4Net.

Here is my configuration file.

   1:  <?xml version="1.0" encoding="utf-8" ?>
   2:  <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
   3:        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   4:        autoReload="true">
   5:    <targets>
   6:       <target name="logfile" xsi:type="File" fileName="C:\Logs\owstimer.txt" 
   7:  layout="${level:padding=-6} ${longdate}  ${logger:shortName=true} ${message}"/>
   8:     </targets>
   9:   
  10:    <rules>
  11:      <logger name="*" minlevel="Trace" writeTo="logfile" />
  12:     </rules>
  13:  </nlog>

Again for more detailed information see the documentation on the NLog project site : http://nlog-project.org/wiki/Configuration_file

Sharepoint specifics

To get it to work in SharePoint

  • Copy the NLog dll in the GAC
  • Copy the above configuration file in the same folder as your web.config file and name it ‘NLog.config’.
  • Deploy your customizations (web parts, eventhandlers, master pages, ….)
  • Do an iisreset (or Application Pool refresh)

And that’s it…

Note : For debugging my custom timer jobs I had to copy the same file in the \bin folder of my SharePoint hive.

Note : Don’t forget to start stop the SharePoint timer service so the service picks up the new version of your dll)
net stop “Windows SharePoint Services Timer”
net start “Windows SharePoint Services Timer”

Read Full Post »

We have discussed the SharePoint 2007 SPDispose tool here before. A new version is now available with SharePoint 2010 support and a Visual Studio add-in.

In addition to dispose guidelines they have also added rules on when not to Dispose. For example you do not want to dispose your SPWeb en SPSite objects in your SPContext.

More information can be found on http://blogs.msdn.com/b/rogerla/ and on the SPDispose codeplex page.

Download is available on here on the Microsoft download site.

Read Full Post »

When trying to deploy my SharePoint 2010 solution via Visual Studio 2010 I got the following error.

Error occurred in deployment step ‘Recycle IIS Application Pool’: <nativehr>0×80070005</nativehr><nativestack></nativestack>

Turned out that I forgot to add my user to the “Site Collection Administrators”.

Go to “Site Actions” of the root site , add your user to the list Site Collection Administrators and problem solved.

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.