今天我在我们的剃刀视图上开启了预编译。
我们几乎都在使用引用的程序集,包括mvc dll和 System.Web.WebPages 。
起初我收到的错误是 System.Web.WebPages 的版本在本地构建时没有匹配,所以我在Web上添加了一个条目.Config
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
这解决了导致我假设编译器忽略引用提示路径和<SpecificVersion>
内容的问题?
在web.config中使用它,我们的本地构建工作正常(我们碰巧在GAC中也有所有dll)。
在构建服务器上运行构建脚本会导致错误:
{OurPath}\web.config (44): Could not load file or assembly 'System.Web.WebPages,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of
its dependencies. The system cannot find the file specified.
这里发生了什么?我可以看到System.Web.WebPages dll位于编译输出的bin中,为什么构建服务器无法找到它呢?也许我不知道有什么依赖?
其次,为什么proj文件中的提示路径似乎对正在使用的程序集没有影响,即使将SpecificVersion设置为true?