Iain
Iain

Reputation: 1734

Umbraco 7.2 cannot add controller

I'm trying to add a controller to the Controllers folder in my Umbraco 7.2 project (I've created a new empty ASP.NET MVC 4 in VS2013) but I'm getting the error

Could not load file or assembly 'ClientDependency.Core, Version=1.7.1.2, Culture=neutral, PublicKeyToken=null` or one of its dependencies. The system cannot find the specified file.

Why is this?

Upvotes: 4

Views: 1667

Answers (4)

cheesemacfly
cheesemacfly

Reputation: 11762

This is a known issue in Umbraco 7.2.0 and 7.2.1 (and probably others). It has been fixed on 7.2.2 but even when/if you update you might still experience the issue.

Let's not follow the following workaround because it will put your website at risk. Read this: http://umbraco.com/follow-us/blog-archive/2015/2/5/security-alert-update-clientdependency-immediately

The suggested workaround is to run the following command in the Package Manager Console:

Uninstall-Package ClientDependency -Force

And once the uninstall is done:

Install-Package ClientDependency -Version 1.7.1.2

Source: http://issues.umbraco.org/issue/U4-5996 and https://our.umbraco.org/forum/getting-started/installing-umbraco/38333-Error-creating-Controller-in-Umbraco-v6?p=2#comment169649

Your only 2 options are really:

  1. Update to Umbraco >= 7.2.2: Update-package UmbracoCms

  2. Add your controllers as classes and manually inherit from Controller or UmbracoController (or other base controller classes you want to use)

Upvotes: 1

Nurhak Kaya
Nurhak Kaya

Reputation: 1781

Upgrading the umbraco mvc to the latest version(v7.2.2) solves the problem.

I use Nuget Package Manager v2.8.50926.663 and Visual Studio 2013.

Hope this helps you as well.

Upvotes: 0

bw3740
bw3740

Reputation: 31

I had the same problem tonight. I changed the versions in packages.config to the following:

<package id="ClientDependency" version="1.7.1.2" targetFramework="net45" />
<package id="ClientDependency-Mvc" version="1.7.0.4" targetFramework="net45" />

Make sure the bin dir matches and you should be good to go. You might need to shutdown the project in VS and reopen it too. If you run into the same issue with EntityFramework, change to 5.0.0 and make sure the correct version is in your bin dir.

Upvotes: 0

dampee
dampee

Reputation: 3447

Normally if you add umbraco to your project, it will also add ClientDependency as a DLL reference. You should check if you have these DLL's in your bin folder.
I am pretty sure you don't have them.

IF you have the dll's in your BIN folder, it's the wrong version. In that case you need to clarify your setup more indepth.

Upvotes: 1

Related Questions