Background:
I have developed a Farm solution webpart for SharePoint 2013 Enterprise more than a year ago. This project uses two DLL which are:
- sample_1.dll
- sample_2.dll
The whole solution consist:
- (2) Class libraries build in Framework 4.0 (for use the SharePoint Dll's reference described below).
- SharePoint 2013 visual webpart.
These DLL's uses the following SharePoint DLL reference:
Microsoft.SharePoint.dll
: "runtime version used is v4.0.30319 / version 15.0.0.0".
These DLL's are registered in the PC that I used for develop this project and the project itself was implemented in a test site.
Due to certain limitations that I'm afraid I can't explain in detail, the Application pool and the site "in IIS" was shutdown after delivery this project to the client (mostly for saving "RAM")...
Now, the site and application pool has been turned on again. To my surprise, the site hasn't the webpart anymore and I had to start the implementation again.
Problem:
When I tried to add the webpart in a test page in the test site, I get this error:
Checking the logs, I found this detailed error:
Getting Error Message for Exception Microsoft.SharePoint.WebPartPages.WebPartPageUserException: $Resources:core,ImportErrorMessage; ---> System.Reflection.TargetInvocationException: An exception occurred in the target of an invocation ---> System.IO.FileNotFoundException: Could not load file or assembly 'sample_1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f1cd0442b97c7541' or one of its dependencies. The system cannot find the file specified.
The web.config
file has added the entries in the entries in SafeControls
tag.
I have used gacutil.exe
for register those DLL's, but, they aren't registered in the following location:
C\Windows\assembly
Instead, they're registered in
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\sample_1
Which, according to this link I used the 4.0 version of gacutil.exe
I should use the 2.0 version.
I really don't understand why these DLL's need to be in the first location.
C:\Windows\assembly
immediately solves the problem? Is this a pure SP2013 site (not migrated from SP2010)? Is your Web part built specifically for SP2013 (with VS20102 or above)?