DotNetNuke项目调用遇System.IO.FileNotFoundException问题求助
Troubleshooting 'System.IO.FileNotFoundException' in DotNetNuke Assembly Loading
Project Setup Recap
Let’s start by confirming your setup to align on the problem context:
You’ve built two DotNetNuke projects:
FormAndList: Contains theUpdateRowmethod that attempts to invoke logic from the second projectFormAndList_Ext: Hosts theUserDefinedControllerclass thatFormAndListdepends on
Relevant Code Snippets
FormAndList - UpdateRow Method
public void UpdateRow(DataSet ds, int ModuleId, int TabId) { UserDefinedController udtc = new UserDefinedController(); errMessage = udtc.userDefinedLogic(ds); }
FormAndList_Ext - UserDefinedController Class
public class UserDefinedController { #region Constructors public UserDefinedController() { // Truncated constructor implementation from your snippet } // Assumed implementation of the called method public string userDefinedLogic(DataSet ds) { // Your custom logic here } }
Common Causes & Fixes for the FileNotFoundException
This error occurs because DotNetNuke can’t locate the FormAndList_Ext assembly at runtime. Let’s work through the most likely fixes step by step:
1. Validate Project Reference Configuration
- In your
FormAndListproject, confirm the reference toFormAndList_Extis properly added:- Right-click
FormAndList→ Add → Reference → EnsureFormAndList_Extis checked under the Projects tab.
- Right-click
- Set the reference’s Copy Local property to
True:- Right-click the
FormAndList_Extreference inFormAndList→ Properties → ToggleCopy LocaltoTrue. This ensures the assembly is copied toFormAndList'sbinfolder during builds.
- Right-click the
2. Check DotNetNuke’s Root Bin Directory
DotNetNuke loads assemblies from its site-wide bin folder by default. Verify:
FormAndList_Ext.dll(and.pdbfor debugging) exists in your DNN site’s rootbindirectory.- For local development, add a post-build event to
FormAndList_Extto auto-copy the assembly to the DNN bin:- Go to
FormAndList_Extproject properties → Build Events → Add this command (replace the path with your DNN site’s bin folder):copy "$(TargetDir)*.dll" "C:\YourDNNSitePath\bin" /Y copy "$(TargetDir)*.pdb" "C:\YourDNNSitePath\bin" /Y
- Go to
3. Resolve Version or Strong Naming Conflicts
- If
FormAndList_Extis strongly named, ensure the version referenced inFormAndListmatches the version in the DNN bin folder. Version mismatches will block assembly loading. - Check your DNN site’s
web.configfor<assemblyBinding>redirects that might be overriding the expected assembly version.
4. Debug Assembly Loading with Fusion Logging
To get granular details about why the assembly isn’t loading:
- Open the Developer Command Prompt for Visual Studio as an administrator.
- Run
fuslogvw.exe(Assembly Binding Log Viewer). - Click Settings → Select Log bind failures to disk → Choose a log directory.
- Reproduce the error, then check the fusion log to see exactly where DNN is searching for
FormAndList_Extand what’s causing the failure.
5. Verify Module Packaging (If Deploying)
If you’re packaging these as DNN modules:
- Ensure
FormAndList_Ext.dllis included in the module package’sbinfolder. - Confirm your module manifest (
.dnnfile) listsFormAndList_Extas a required assembly resource.
内容的提问来源于stack exchange,提问作者Chan Yoong Hon
相关产品推荐
相关产品推荐

