I have a class library created in .NET 4.0 When I use the Enterprise Library Configuration tool to load this assembly, I get:
Error loading assembly: Could not load file or assembly. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
I have tried the Configuraiton tool in both the Enterprise Application blocks 4.1 and 5.0 beta. Is .NET 4.0 not supported by the Configur开发者_运维问答ation tool.
alt text http://www.freeimagehosting.net/uploads/th.d7fde7a166.jpg
The problem is that the EntLibConfig.exe runs in .NET 2.0 by default while it tries loading an assembly that just can be loaded within a .NET 2.0 process. You could try to change the configuration of the EntLibConfig.exe to run in .NET 4.0 by changing the EntLibConfig.exe.config file.
No promises here, but try adding this to the EntLibConfig.exe.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<!-- Find out the exact version number and
put that in the version attribute. -->
<requiredRuntime version="v4.0.0.0" />
</startup>
...
</configuration>
Let me know if this worked out for you.
If you haven't read already, I'd recommend you to read this article about avoiding configuration pitfalls with incompatible copies of Enterprise Library. It's written by one of the developers of EntLib.
精彩评论