Closed MrVermond closed 6 years ago
Sounds like it's not finding your app.config with assembly binding redirects. Usually NuGet takes care of that for you. Can you verify you have redirects in place and NUnit is using them?
Hi Tillig,
the app.config is defenetely in the right place. also the redirct is setup correctly:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
do you have an idea how can i make sure that nunit is using the app.config?
I've updated the formatting of your previous two notes to format the code correctly. You may have noticed things with greater-than/less-than marks like List<object>
don't show up right otherwise. Use a single backtick around single-line code items and triple-backticks around longer code snippets.
Based on this nunit issue it sounds like if you have MyTests.dll
and MyTests.dll.config
in the same folder, NUnit should automatically use it. Is that what you have set up?
Also, I see you're redirecting to Autofac 4.1.1.0, but you said you're using NuGet package 4.2.1.0, so the assembly redirect should be to 4.2.1.0, so your app.config binding redirect appears wrong.
Hi Tillig,
thank you for the format adjustments. Sorry for the time passed by, but all the holidays in between has kept me form checking the issue. Thank you for the hint about the redirect setup. I will check it in the next days in our project.
BR Nick
Hey, I ran into the similar problem. But it is not a problem of autofac, when the redirect is running.
I got basically a C++/CLR Project, which got nothing from this automation a normal .Net framework project is favored by. So I do manually add all the references and update the package.config. But until now, I didn't need to provide an app.config. Following comes my solution for c++/clr projects.
Add-BindingRedirect
. This will post the binding redirects and add/overwrite or inserts the app.config to the project with the entries. yeahcopy app.config "$(TargetPath).config"
The last copy command did it and well my test are running through, all and not only the pure managed ones.
I should give credit to this explanation which helped at the end with the copy command. C++/CLR Project with an app.config
@MrVermond We had some merge problems which leaded to corrupted app.configs and not running tests or applications. Sometimes it was to much to look into every binding-redirect entry so I execute in the nuget manage console the command Update-Package -reinstall
Microsoft ref and then it solved part of the problems. Once I deleted the app.config beforehand to be sure.
Hi guys,
I just ran into a possible issue with this nuget package (Version 4.2.1.0). When i use the interceptors in a unit test like
builder.Register(c=> new List<object>()).EnableInterfaceInterceptors();
the test fails when i start it with the nunit console with the error:
System.IO.FileLoadException : Could not load file or assembly 'Autofac, Version=4.0.0.0, Cu lture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located ass embly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Which make sense, since im having the later version of autofac in use 4.1.1.0.
Is it possible that this package depends uppon a specific version of autofac? If so the documentation should be adjusted. But i guess that this could be a bug.
BR Nick