Fixing the SmartPart File Not Found

Searching for the phrase "SmartPart File Not Found" on Live Search returns many, many pages. It looks like I was not alone, which is a great feeling to have 🙂

The error seems to appear when users browse to the Web Parts Gallery and try to add a new web part. When adding a new web part, many things are checked for us under the hood. What I know, is that we need to make sure that our assemblies are signed and placed in the GAC and that all their references on Pages and in the Web.Config are good as well as their respective SafeControl entries are correct.

Here, it was the case of the SmartPart and one of its references, System.Web.Extensions. The SmartPart (latest version) found here http://www.codeplex.com/smartpart has a reference to System.Web.Extensions 1.0.61025.0. See below. The shot below was brought to you by .NET Reflector http://www.red-gate.com/products/reflector/

image

So if you have Ajax 1.0 Extensions and your Web.Config is good, you are probably fine. But if you don’t have those Extensions and have upgraded to ASP.NET 3.5 with Ajax included, and you wanted to use the SmartPart, well, you know the rest. The latest System.Web.Extensions are of version 3.5.0.0.

Given all this good information at my disposal, I can now have a better theory of why this is happening. Due to the fact that we don’t have the earlier Extensions installed and configured, the runtime was firing a File Not Found error. The SmartPart had a reference to the old version of the Extensions, but the system doesn’t. So how can we fix this? Fortunately, we can inform the system (the runtime) that we have a new binding rule for the Extensions assembly. You can find more about this here http://msdn.microsoft.com/en-us/library/2fc472t2(vs.71).aspx

Knowing about binding redirects, I went ahead and made the necessary modifications to the Web.Config file. See below.

<dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="1.0.61025.0" newVersion="3.5.0.0" />
</dependentAssembly>

 

Hope this helps someone out there.

Good luck!

Advertisements

About jharbieh

I'm an IW Solutions Architect with background in requirements gathering, planning, design, architecture, and development (not necessarily in the right order). Currently, my focus is on the Microsoft Productivity and Collaboration space. Hope you enjoy what I write about here. Thanks for visiting. Johnny Harbieh
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s