Archive

Archive for January, 2010

Failure adding assembly to the cache

January 31st, 2010 Dominick Cosgrove No comments

Issue

When copying files to the GAC I occasionaly get the following message in the Visual Studio OutPut window on my development VPC:

Failure adding assembly to the cache: Access denied. You might not have administrative credentials to perform this task. Contact your system administrator for assistance.

Also I cannot see any assemblies in the GAC through Windows Explorer, while it is this state.

clip_image002

Background

When developing features for SharePoint, it is common practice to deploy only the Signed Assembly to the GAC, rather that re-deploying the whole SharePoint solution. Personally depending on the project I use one of two mechanisms:

WSPBuilder – Copy to GAC

WSPBuilder is my tool of choice for increasing productivity while developing SharePoint Solutions. One of the functions of WSPBuilder is Copy to GAC, which does exactly as the name suggest:

clip_image004

PostBuild Task
Some clients don’t allow WSPBuilder to be installed or they prefer a more custom project structure. In these cases I tend to use Project Post Build Tasks. You can use the Edit Post Build… function to add parameters to your post build command, as shown below. I tend to use the GACUtil command to copy the assembly to the GAC and the iisapp.vbs to recycle the application pool. A sample script is show below. This is required to ensure that the Just In Time (JIT) compilation occurs again.

clip_image006

clip_image008

"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\GacUtil.exe" /if "$(TargetPath)" /nologo
"%systemroot%\system32\iisapp.vbs" /a "SharePoint – 9000" /r

Resolution

Although I cannot actually explain what is causing this issue, I found that if you restart the Indexing Service through the Windows Services Management Console, the problem is resolved.

If anyone has an explanation as to why this occurs I would be grateful.

clip_image010

SharePoint eMagazine

January 29th, 2010 Dominick Cosgrove No comments
Categories: Uncategorized Tags: