River
River

Reputation: 1487

mvc3 view cannot load namespace(How do views reference dlls)

I updated the dll references in my mvc3 site. they are the same dlls but different versions. I did this by first deleting them, then added the updated ones. All compiles properly. However at runtime, I get runtime errors of cshtml files not being able to reference some namespaces. When I open these cshtml files, the vs2010 does show an error of undefined namespaces. BUT the same namespaces work fine in codebehind cs files. In the respective view web.config file. I have tried:

  <namespaces>
        ...
        <add namespace="myassembly" />
      </namespaces>

or 
      <controls>
        <add assembly="myassembly, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="myassembly" tagPrefix="myassembly" />
      </controls>

I still can't rectify the problem in my view. When I revert to old dlls version, EVERYTHING works fine and I don't need modification in view web.config. It seems like its a case of the view still trying to reference the old dll version, hence it can't find them when I update to new versions.

How do views reference dlls?

Thanks

Upvotes: 2

Views: 926

Answers (1)

Mihalis Bagos
Mihalis Bagos

Reputation: 2510

You have to use the web.config file that is inside the Views folder, not the one that is in the root directory of your project.

Upvotes: 1

Related Questions