Skip to content

Instantly share code, notes, and snippets.

@jincod
Created October 5, 2012 16:47
Show Gist options
  • Save jincod/3840929 to your computer and use it in GitHub Desktop.
Save jincod/3840929 to your computer and use it in GitHub Desktop.
FluentSecurity 1.4 and ASP.NET MVC 4

Last night I've update asp.net mvc to 4 version in my project. I'm using FluentSecurity version 1.4. After references were updated, and I ran security tests and got the exception:

System.Security.VerificationException : Method FluentSecurity.ConfigurationExpression.For: type argument 'MvcApplication1.Controllers.HomeController' violates the constraint of type parameter 'TController'.

Should add to test library app.config for fix this problem. App.config:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

And now all tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment