ASP.NET网站在本地生成,但在生成服务器上抛出MSB3268 [英] ASP.NET web site builds locally, but throws MSB3268 on the build server

查看:96
本文介绍了ASP.NET网站在本地生成,但在生成服务器上抛出MSB3268的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站解决方案中添加了一个项目.一切都在本地和构建服务器上构建良好.

我在Web代码中添加了一行以在新项目中调用方法.一切都在本地构建并运行良好,但是破坏了构建服务器上的构建.

我遇到了类似这样的错误:

警告MSB3268:无法解析主引用"C:... \ ProjectName.dll",因为它间接依赖于框架程序集"Assembly.Name(例如System.Runtime)",版本= 4.0. 0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a"在当前目标框架中无法解决..NETFramework,Version = v4.5".要解决此问题,请删除引用"C:... \ ProjectName". dll"或将您的应用程序重新定位到包含"System.Runtime,版本= 4.0.0.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a"的框架版本.

所有警告之后,构建失败,并显示一个错误,指示找不到命名空间ProjectName.考虑到项目的依赖关系无法解决,这是有道理的.

起初,我想知道针对错误的框架是否存在问题.但是4.5网站引用了4.0和4.5项目的混合体.这是第一个失败的人.

此项目与其他项目之间的唯一区别是,它引用了第三方DLL.因此,显然他们的依存关系是无法解决的依存关系.

解决方案

此帖子掌握了以下关键信息:

After all the warnings, the build failed with an error indicating the namespace ProjectName could not be found. Makes sense considering the project's dependencies couldn't be resolved.

At first I wondered if there was an issue with targeting the wrong framework. But there was a mix of 4.0 and 4.5 projects referenced by the 4.5 website. This was the first one that had failed.

The only difference between this and the other projects was that it referenced third-party DLLs. So apparently their dependencies are the ones that couldn't be resolved.

解决方案

This post held the key: http://devsilos.blogspot.com/2014/10/msb3268-while-targeting-aspnet-web-site.html

The author suggests:

aspnet_compiler for some reason does not take into account the .dll-s that reside under the Facade directory of 4.5 assemblies (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades). It looks only under C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5

My extrapolation on that idea is that maybe the compiler doesn't take into account DDLs in the Facades directory if they're referenced by a third-party DLL rather than directly from your project.

The solution, as suggested by the author, was to find the DLLs matching assemblies mentioned in the MSB3268 warnings and copy them from Facades to its parent directory.

I think my problem/solution differed from the blog's in that it had nothing to do with the .NET Framework version targeted. It had only to do with whether the build server's compiler looked in the right places to resolve third-party DLLs' dependencies.

The problem caused about ten hours of frustration. I hope this helps someone else avoid that!

这篇关于ASP.NET网站在本地生成,但在生成服务器上抛出MSB3268的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆