问题描述:

I'm starting to play with VS2013 standard templates for SPA: I'd like to build a simple web app based onto Typescript, AngularJS and Bootstrap 3, plus WebAPI on the server side; among the standard templates I find one for SPA, which is Knockout based but could be useful as a starting point. So I tried to use it, but after updating all the NuGet packages I keep getting this exception at startup:

Could not load file or assembly 'Microsoft.Owin.Security.OAuth,

Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or

one of its dependencies. The located assembly's manifest definition

does not match the assembly reference

All you have to do to repro this is creating a new SPA web application, update all the NuGet packages and run.

  • I tried to double click the version conflict warning, but it seems VS cannot resolve it automatically.
  • I tried to add the binding to 2.1.0.0 for this assembly, like (I removed the tags as they seem to cause a mess in this post):

    ...assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" ... bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0"

but this does not remove the exception.

  • I tried to remove the bin folder and rebuild all, with no luck.

Could anyone give a hint or suggest a better template for my requirements?

网友答案:

Honestly, I spend lots of time removing libraries like Owin to get a nice clean project template set up. My recommendation is you do the same...just use your nuget package manager to remove them all. Just spool up a basic application.

Below is a manifest of what I left behind for the occasion. (Omit the MVC specific libraries if you're not going that route)

<packages>
  <package id="Angular.UI.Bootstrap" version="0.11.0" targetFramework="net45" />
  <package id="Angular.UI.UI-Router" version="0.2.10" targetFramework="net45" />
  <package id="AngularJS.Animate" version="1.2.16" targetFramework="net45" />
  <package id="AngularJS.Core" version="1.2.16" targetFramework="net45" />
  <package id="AngularJS.Locale" version="1.2.16" targetFramework="net45" />
  <package id="AngularJS.Resource" version="1.2.16" targetFramework="net45" />
  <package id="AngularJS.Touch" version="1.2.16" targetFramework="net45" />
  <package id="Antlr" version="3.4.1.9004" targetFramework="net45" />
  <package id="bootstrap" version="3.0.0" targetFramework="net45" />
  <package id="EntityFramework" version="6.1.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Mvc" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.Razor" version="3.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebPages" version="3.1.2" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
  <package id="sugarjs" version="1.4.1" targetFramework="net45" />
  <package id="WebGrease" version="1.5.2" targetFramework="net45" />
</packages>
相关阅读:
Top