3

Summary: I have ONE project in a solution that I can't point to WebPages 3.0 (or Helpers 3.0). The others are fine, but one just immediately resolves to the Program Files x86 2.0 assembly.

Background: I have an MVC app that I inherited. I've done a few updates to it, bringing it up to MVC-3 in the last iteration. To cut to the chase, I've found myself in an unexpected bind that's seemed to snowball through my attempted fixes.

I always strive for binary deployments, eliminating the need to install packages on the build server and the web servers. Therefore, I had MVC/ASP.Net WePage binaries in the solution tree with references to those local copies.

What I've changed: Believe it or not, I've never messed with NU GET, and decided to give it a whirl. I removed all my local binaries (2x, 3x, 100x checked to make sure) and added MVC 5 and its dependencies. This seems great because I can eliminate my home-grown binary pattern in favor of the packages that are stored under the solution tree on disk/TFS. I also figured I might as well point all projects to the latest 4.5 FW.

Problems: On compilation VS is complaining that I have v2 and v3 of the mentioned DLL, but I have no references to v2. Also, before even compiling, if I remove the reference and re-add it (pointing to the package lib content) it immediately comes in as v2.0 and the resolved folder is the x86 v2 instance.

While trying to resolve this I've removed the packages and reinstalled them several times to no avail.

I've also tried adding a binding redirect to we.config, but I suspect that's a runtime thing? I have a number of other projects in this solution, all of which are fine, pointing to 3.0!

I've used reflector to look at the references for all the assemblies in the bin folder, thinking I'd find something pointing to pages 2.0, but I don't.

Looking in the csproj file I see the version hard-coded to 2.0 in the Include. I changed it to 3.0 and when I reload the solution it's reverted to 2.0. Argh!

I've closed and reloaded the solution a hundred times. I've cleaned it 1,000 times. I've manually removed the obj/bin folders multiple times.

I just don't know how else to debug this!

  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly

    <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>

Reference showing 2.0 resolution

4

1 回答 1

1

我在网页和助手的 csproj 中找到了第二个包含!我不知道他们是怎么到那里的。卸载 NUGET 包将删除第一个引用,但不会删除第二个。更令人沮丧的是,第二个参考没有指定版本或位置。添加版本和位置特定参考(NUGET 或手动)将立即被 GAC 版本覆盖!

于 2013-11-01T14:18:06.843 回答