问题
The latest documentation still refer's to the ConfigurationSettingsReader
class which seems to be missing from the updated Autofac.Configuration
assembly.
How do get the equivalent of this code to function in version 4.0.0.
I have this configuration:
<section name="dependencies"
type="Autofac.Configuration.SectionHandler, Autofac.Configuration" />
...
<dependencies>
<modules>
<module type="MyModule, MyAssembly.Service" />
</modules>
</dependencies>
and this code.
// register the application overrides.
container.RegisterModule(new ConfigurationSettingsReader("dependencies"));
additionally,
the new autofac.configuration assembly is the only autofac assembly dependent on framework version 4.5.1, and not 4.5
回答1:
The 4.0 version of Autofac.Configuration only supports the Microsoft.Extensions.Configuration
manner of configuration. There is no ConfigurationSettingsReader
in the 4.0 version nor is the configuration XML the same format as it used to be.
I have updated the documentation to be more clear about this. Sorry for the confusion.
Core Autofac and the dependent integration libraries were originally all released at .NET 4.5.1+ support when .NET Core was released. This was for a variety of reasons including some dependency and testing libraries only supporting .NET 4.5.1 during development.
Since then, core Autofac and a couple of the integration libraries have been able to go back and support .NET 4.5 but that change is slow to trickle through. It may not be possible for all the integration libraries to go back. I pushed v4.0.1 of Autofac.Configuration for .NET 4.5 compatiblility...
HOWEVER:
.NET 4.5 IS NO LONGER SUPPORTED BY MICROSOFT. You will start running into more of these incompatibility issues with Autofac and other dependencies if you decide not to upgrade to .NET 4.5.2 or higher. I would strongly recommend doing that as soon as you can so you don't run into further issues.
来源:https://stackoverflow.com/questions/39364698/autofac-upgrade-to-version-4-0-0-is-missing-configurationsettingsreader