Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6072155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:07:43+00:00 2026-05-23T10:07:43+00:00

I installed Autofixture and Moq using Nuget.So I have moq version 4. When running

  • 0

I installed Autofixture and Moq using Nuget.So I have moq version 4.

When running the following code

var fixture = new Fixture().Customize(new AutoMoqCustomization());
fixture.CreateAnonymous<ISomething>();

the following error shows up

System.IO.FileLoadException : Could
not load file or assembly ‘Moq,
Version=3.1.416.3, Culture=neutral,
PublicKeyToken=69f491c39445e920’

I’ve also tried redirected it to the v4,but with no luck.

<configuration>
  <runtime>
    <assemblyBinding>
    <dependentAssembly>
      <assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral"/>
      <bindingRedirect oldVersion="3.1.416.3" newVersion="4.0.10827.0"/>
    </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

What could be the problem here ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:07:44+00:00Added an answer on May 23, 2026 at 10:07 am

    In order to redirect an assembly binding in a configuration file, you need to specify the urn:schemas-microsoft-com:asm.v1 namespace in the <assemblyBinding> element, like in this example:

    <configuration>
        <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                    <assemblyIdentity name="Moq"
                                      publicKeyToken="69f491c39445e920"
                                      culture="neutral"/>
                    <bindingRedirect oldVersion="3.1.416.3"
                                     newVersion="4.0.10827.0"/>
                </dependentAssembly>
            </assemblyBinding>
        </runtime>
    </configuration>
    

    It’s interesting to point out that library assemblies compiled with an earlier version of .NET (such as Moq 3 and AutoFixture 2.1) will automatically be loaded in a process running on .NET 4.0 because of In-Process Side-by-Side execution. Here’s a quote from MSDN about this:

    If an application is compiled using
    the .NET Framework 4 runtime but
    includes a library that was built
    using an earlier runtime, that library
    will use the .NET Framework 4 runtime
    as well. However, if you have an
    application that was built using an
    earlier runtime and a library that was
    built using the .NET Framework 4, you
    must force your application to also
    use the .NET Framework 4

    Related resources:

    • Redirecting Assembly Versions
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed the playframework fbconnect module (version 0.6). I keep getting the following error.
I installed with NuGet the packages NHibernate and Castle.Core 3.0 for a new project.
I installed ActiveReports from their site. The version was labeled as .NET 2.0 build
I installed the wxWidgets source code, compiled it and am linking the libraries thus
I installed the ReSharper evaluation version and uninstalled it. Afterwards Visual Studio's Intellisense stopped
I installed the latest stable xampp package, and received the following error page when
I installed Google Chrome Portable on the user's desktop and have the default homepage
Installed SlikSvn on Window 2008 server Created Repository at c:\dia\svn\repos running this windows service
I installed the plugin for python and it detects the python code, but how
I installed FFMPEG using apt-get. It comes by default compiled with some options: configuration:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.