TinyMCE Wiris插件本地正常服务器报CS0433错误求助
The error you're hitting is a classic assembly conflict issue: two distinct DLLs (WIRISplugin.DLL and pluginwiris.DLL) both contain the com.wiris.plugin.factory.PluginBuilderFactory type, which confuses ASP.NET's assembly loader. This often pops up after deployment because local environments tend to have cleaner dependency setups, while servers can accumulate old or duplicate files over time. Let's walk through the fixes step by step:
1. Clear Cached Temporary ASP.NET Files on the Server
First, let's eliminate the stale assemblies mentioned in the error message. On your server:
- Open Command Prompt as Administrator
- Run these commands to clear the cached files for your .NET framework version:
cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files rd /s /q public
This forces ASP.NET to load fresh copies of your application's assemblies from the bin folder instead of using cached duplicates.
2. Audit Your Local Project's Dependencies
Head back to your development project and check for conflicting references:
- Project References: Look for both
WIRISpluginandpluginwirisin your project's references list. If both are present, remove one (stick with the official, up-to-date version provided by Wiris). - NuGet Packages: If you installed Wiris via NuGet, ensure you don't also have a manual DLL reference to the other version. Uninstall any conflicting NuGet packages if necessary.
3. Clean Up the Server's Bin Directory
Connect to your server's application folder and navigate to the bin directory. Delete either WIRISplugin.DLL or pluginwiris.DLL—only keep one consistent version. Double-check that no old, leftover versions are lingering from previous deployments.
4. Add an Assembly Binding Redirect (If Needed)
If cleaning up doesn't resolve the issue, you can explicitly tell ASP.NET which assembly to prioritize. Add this snippet to your web.config under the <configuration> section:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="WIRISplugin" publicKeyToken="YOUR_PUBLIC_KEY" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-XX.XX.XX.XX" newVersion="XX.XX.XX.XX" /> </dependentAssembly> </assemblyBinding> </runtime>
Replace YOUR_PUBLIC_KEY and XX.XX.XX.XX with the actual public key and version number of the DLL you want to keep. You can find these details by right-clicking the DLL in your project, selecting Properties, and checking the "Details" tab.
5. Verify Your Deployment Process
If you're using automated deployment (like CI/CD pipelines, FTP scripts, or Visual Studio publish), make sure it's not copying both DLLs to the server. Check your publish profiles or deployment scripts to exclude the redundant DLL from being deployed.
After completing these steps, restart your IIS site or application pool to ensure all changes take effect. This should resolve the duplicate type conflict.
内容的提问来源于stack exchange,提问作者Fadl Assaad

