1

I have a MCV 4.5 solution with 3 projects. Site, Testing and Model. Site and Model are referencing EF 5.0. I have searched all solution files for a reference to 4.3.1 and have come up empty. I have deleted and recreated all references to EF 5.0

I have a HomeControllerTest.cs that runs just fine. using this as a test

    [TestMethod]
    public void Index()
    {
        // Arrange
        HomeController controller = new HomeController();

        // Act
        ViewResult result = controller.Index() as ViewResult;

        // Assert
        Assert.AreEqual("Modify this template to jump-start your ASP.NET MVC application.", result.ViewBag.Message);
    }

I Created a new LOBControllerTest.cs to support the LOBController.cs in the Site Project. This test class fails with the error 'Could not load file or assembly 'EntityFramework, Version=4.3.1.0' using the following test

    [TestMethod]
    public void Index()
    {
        // Arrange
        LOBController controller = new LOBController();

        // Act
        ViewResult result = controller.Index() as ViewResult;

        // Assert
        Assert.IsNotNull(result);

    }

If I change the above test to execute the HomeController as in the following, it runs just fine.

    [TestMethod]
    public void Index()
    {
        // Arrange
        HomeController controller = new HomeController();

        // Act
        ViewResult result = controller.Index() as ViewResult;

        // Assert
        Assert.IsNotNull(result);

    }

This is a brand new clean install of VS2012 on a clean install of Windows Server 2012.

Any Thoughts?

Update, I forgot to mention I am also using ReSharper 7.1. I'm wondering if that has a setting that I was missing.

I found that there is a documented bug with RS7 stackoverflow.com/questions/12357696/… so I disabled the RS7 testing suite and tried running it directly from VS2012 interface with the same result. So it's not isolated to RS7.

Update:

here's a link https://www.dropbox.com/sh/740w2jsp8i1mslg/pWiwnSewHQ to access this project for anyone who want's to take a look at it. It's nothing special it's just a Template project. We are starting on a new project at work and I'm new to MVC and Test Driven Development so I'm trying to get a head start.

Update 9/21/2012

I believe I've found it. After talking to the Dev who put the original Wholesale template solution together I found that the Repositories folder in the Wholesale.Admin is references a NUGet code package. I checked the package site and found that the latest release is dependent on EF 4.3.1

dependency list image

Update:

This is confirmed. I no longer get the error after downloading and upgrading the solution from the site. I get another error but the 4.3.1 is no longer an issue. Hope the dev will update his NuGet solution, he hasn't updated it in 7 months.

Tim
  • 1,249
  • 5
  • 28
  • 54

2 Answers2

0

Obviously your LOBController references EF 4.3 somehow, somewhere. Check your references in the class library containing this controller, or maybe a dll that's still in the bin folder or in the GAC...

Hope this helps

canderso
  • 662
  • 1
  • 7
  • 19
  • I know where your coming from but I have already went down that path. 4.3 was never installed on this VM. This is a clean install and no references to 4.3.1 are in the solution. – Tim Sep 20 '12 at 14:48
  • Update, I forgot to mention I am also using ReSharper 7.1. I'm wondering if that has a setting that I am missing. – Tim Sep 20 '12 at 15:12
0

After talking to the Dev who put the original Wholesale template solution together I found that the Repositories folder in the Wholesale.Admin references a NUGet code package. I checked the package site and found that the latest release is dependent on EF 4.3.1. I downloaded the source and recompiled referencing EF 5.0 and that cleared the 4.3.1 error

Tim
  • 1,249
  • 5
  • 28
  • 54
  • Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. – Filip Radelic Sep 21 '12 at 23:57
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Nazariy Sep 21 '12 at 23:59