在我的MVC3解决方案中,我做了一些更改,当我在重建后进行调试时,我收到错误:
Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
执行递归GET修复此问题,直到我再次重建,以查看我的更改,然后解决方案中断了相同的错误。我没有更改任何web.config文件,它只是签出的c#代码。
如果程序集不正确,那么递归GET肯定会破坏解决方案吗?我不确定什么是错的
堆栈追踪:
[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
System.Web.Mvc.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +556
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9885060
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
答案 0 :(得分:0)
我刚从构建服务器上遇到类似的东西。问题似乎是System.Web.Mvc.dll的副本正被复制到最后一次成功构建中没有的\ bin中,并且可能是在制作和/或错误路由对System的需求。 Web.WebPages.Razor。
从output \ bin中删除不必要的System.Web.Mvc.dll让我回到了按预期工作。
向output \ bin添加更多.dll(包括System.Web.WebPages.Razor和Microsoft.Web.Infrastructure)也让我重新回到了预期的工作中。
我猜想,即使没有代码/项目更改,也会在构建期间添加"新的.dll"本周早些时候,这是一堆构建服务器补丁的副作用。