CS0433: The type 'Orchard.Layouts.Framework.Elements.Element' exists in both

Topics: General, Troubleshooting
Dec 10, 2015 at 9:55 PM
Hope somebody can help me.
I have lots of equal compiling errors (see error below) on a productive site I migrated from 1.8.x to 1.9.x and this seems to slow down everything.

This is not specific to the Orchard,DynamicForms dll but to lots of dlls.
Any idea why this conflict finding the dll on two different directories occurs?

I thought about disabling dynamic compilation of Orchard but woulrd like to know first why I am getting this kind of errors.


2015-12-10 22:16:41,814 [24]
Orchard.Environment.DefaultBuildManager - Default - Error when compiling assembly under ~/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj.
System.Web.HttpCompileException (0x80004005): d:\websites\lnub.de\v2.3\Modules\Orchard.DynamicForms\Elements\FormElement.cs(6): error CS0433: The type 'Orchard.Layouts.Framework.Elements.Element' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\cb50346a\95f97d40\App_Web_j0ug255j.dll' and 'd:\websites\mysite\App_Data\Dependencies\Orchard.Layouts.dll'
at System.Web.Compilation.BuildManager.PostProcessFoundBuildResult(BuildResult result, Boolean keyFromVPP, VirtualPath virtualPath)
Developer
Dec 11, 2015 at 12:43 PM
I'm afraid I don't know why this happens, but I have seen it before. When it happens to me, I simply blame ASP.NET and delete the temporary ASP.NET files and do a complete rebuild of the solution. Sometimes I do some proper swearing if it doesn't work immediately. ;) Eventually it works.
Dec 11, 2015 at 5:40 PM
Thanks for your reply.

I have no src at productive Server. I hence rebuild locally everything after cleaning up Project. asp.net temp Folder and app_data\dependencies Folder.
After deploying to prod. site, I am now getting Different Errors:


Directly after start:

2015-12-11 18:22:14,815 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:14,925 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:14,925 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Taxonomies'
2015-12-11 18:22:14,925 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:18,450 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:18,450 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:18,466 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Taxonomies'
2015-12-11 18:22:18,466 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:19,277 [12] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:19,293 [12] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:19,293 [12] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Taxonomies'
2015-12-11 18:22:19,293 [12] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:20,088 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:20,853 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:20,868 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:21,664 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:21,664 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:21,664 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:26,179 [7] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:29,940 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:29,940 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:29,956 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Taxonomies'
2015-12-11 18:22:29,956 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:30,642 [12] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:31,688 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:31,688 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:31,688 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Taxonomies'
2015-12-11 18:22:31,688 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:32,592 [12] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:33,360 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'
2015-12-11 18:22:34,077 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Alias'
2015-12-11 18:22:34,077 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Autoroute'
2015-12-11 18:22:34,093 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Taxonomies'
2015-12-11 18:22:34,093 [8] Orchard.Environment.Extensions.Compilers.DefaultExtensionCompiler - (null) - Loader 'ReferencedExtensionLoader' could not load reference 'Orchard.Tokens'




And later very often:

2015-12-11 18:23:00,161 [11] Orchard.Environment.DefaultBuildManager - Default - Error when compiling assembly under ~/Modules/Orchard.DynamicForms/Orchard.DynamicForms.csproj.
System.Configuration.ConfigurationErrorsException: Could not load file or assembly 'Orchard.Layouts' or one of its dependencies. The system cannot find the file specified. (D:\websites\lnub.de\v2.3\modules\orchard.dynamicforms\web.config line 36) ---> System.IO.FileNotFoundException: Could not load file or assembly 'Orchard.Layouts' or one of its dependencies. The system cannot find the file specified.


But the dll is in the bin Folder. Any suggestions here?


In web.config of DynamicForms I see
<system.web>
    <compilation targetFramework="4.5.1">
        <assemblies>
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <add assembly="Orchard.Layouts"/>
            <add assembly="Orchard.Framework"/>
            <add assembly="Orchard.Core"/>
        </assemblies>
    </compilation>
</system.web>
May be the
            <add assembly="Orchard.Layouts"/>
is the issue here?

Would be great if you can give me some hints. thanks!
Developer
Dec 13, 2015 at 11:21 AM
Perhaps it's a dynamic compilation issue. Do you have that enabled or disabled (see HostComponents.config in the Config folder).
Dec 14, 2015 at 9:38 PM
Yes, it is a dynamic compilation issue. I disabled the exceptions do not occur.