File not found

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

This post was most recently updated on February 15th, 2021.

2 min read.

This post is about fixing one of the absolute most annoyingly unspesific errors 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 below:

File not found
File not found

There are quite a few reasons that can cause this error, but after the obvious ones (some files failing to be included in the package, botched wsp deployment, errorenous 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 acceptance testing environment, feature activation failed because of “File not found”-error, both when accessing the site collection features using 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.

Reason for also the PowerShell 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