File not found

“File not found”error when trying to activate a custom feature on SharePoint

This post was most recently updated on September 30th, 2022.

2 min read.

This post is about fixing one of the most annoyingly unspecific errors that you can get when activating (Feature Framework) features on SharePoint – “File not found”. Whatever that might mean, right?


Ugh. A plain and simple “File not found” is one of the more annoying errors one can stumble upon when trying to activate a feature. It usually gets thrown at you quite quickly after hitting the activation button on your feature management page – and it’ll look somewhat like the below:

File not found
File not found

There are quite a few reasons for this error, but after the obvious ones (some files failing to be included in the package, botched wsp deployment, erroneous URLs in event receiver) one thing to check might be the alternate access mappings.

Solution to the “File not found” exception

In our case, we had an event receiver with a code similar to this:

SPList list = ... // logic for finding out a certain list, omitted for clarity

(using SPSite site = new SPSite (list.ParentWeb)) {

This code worked fine in multiple development environments, but when deployed to the acceptance testing environment, feature activation failed because of the “File not found” error, both when accessing the site collection features using a web browser and PowerShell. Due to certain authentication settings, we were accessing the site using a localhost:123 -typed address, but the list.ParenWeb returned an address with the actual, configured host header – therefore the code above always failed when trying to access the code inside the using -block.

The reason for the PowerShell also failing is not clear, as we were using the actual address (instead of localhost) and still had the same error, but at least we were able to activate the feature using the browser GUI.

4.3 3 votes
Article Rating
Notify of

Inline Feedbacks
View all comments