TFS 2013-构建:ASP.Net 4.5.1网站,我收到此错误:
警告MSB3268:主要参考 C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll 无法解析,因为它间接依赖于框架程序集 System.Runtime ,版本= 4.0.10.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a,其中在当前目标框架中无法解决。 .NETFramework,Version = v4.5.1。若要解决此问题,请删除引用 C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll,或将您的应用程序重新定位到框架版本,包含 System.Runtime,版本= 4.0.10.0,区域性=中性, PublicKeyToken = b03f5f7f11d50a3a。最初使用Unity 1.0.0.0的所有项目和站点均为4.0。我将其升级到4.5.2。同样,上面错误中的MyProj1也在引用Unity,我也将其升级到了3.5.1。
请阅读以下内容:unity.codeplex/workitem/12756 构建服务器已经具有变通办法中指出的更新的4.5.2。
所以我降级到4.5.1,但仍然收到错误。
-
解决方案构建可以通过Visual Studio 2013在本地进行优化。
-
在TFS中构建独立的类库项目很好,但是当添加MyProj作为对我的网站的引用时,失败。
有任何想法吗?
我需要
解决方案由于项目的依赖性,我不得不将Unity升级到3.5。在其他项目上,此错误再次出现。这次,终于解决了。
这个帮助了我: devsilos.blogspot/2014/10/msb3268-while-targeting-aspnet-web-site.html
解决方案我从以下位置复制了所抱怨的所有文件:
C:\Program Files (x86)\参考程序集\Microsoft\Framework.NETFramework\v4.5.2\Faades
To
C:\Program Files(x86)\参考程序集\Microsoft\Framework.NETFramework\v4.5.2
以下是上面链接中的解释,以防万一将来由于任何原因而下降:以下有趣的事实: aspnet_compiler由于某种原因未考虑驻留在4.5程序集Facade目录下的.dll-s (C:\Program 文件(x86) \回覆参考程序集\Microsoft\Framework.NETFramework\v4.5\Facades)。它看起来仅在C:\Program Files(x86)\Reference Assembly\Microsoft\Framework.NETFramework\v4.5
下结果整个事情失败了,因为System.Threading.Tasks 和System.Runtime .dll-s都位于Facades目录下,而不是v4.5内的。
现在解决方案:
- 只需将缺少的.dll-s从Facade复制到v4.5 目录。
- 在.sln文件中将TargetFrameworkMoniker设置为4.5.1。确切的语法如下:TargetFrameworkMoniker = .NETFramework,Version%3Dv4.5.1。
在这种情况下,发生的情况是aspnet_compiler无法识别所需框架的确切版本,并试图尽可能使用GAC。如果4.5是在构建机器上安装的最高版本,我相信它应该可以工作。
TFS 2013 - Build: ASP.Net 4.5.1 website I get this error:
warning MSB3268: The primary reference "C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.1". To resolve this problem, either remove the reference "C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".All projects and site was 4.0 initially using Unity 1.0.0.0. I upgraded it to 4.5.2. Also the MyProj1 in the error above is referencing Unity and I upgraded it to 3.5.1 as well.
Read this: unity.codeplex/workitem/12756 The build server already have the updated 4.5.2 pointed in the workaround.
So I downgraded to 4.5.1 but still getting the error.
Solution builds fine locally via Visual studio 2013.
The stand alone class libraries project build in TFS fine but when MyProj is added as a reference to my Website, that's when it fails.
Any ideas?
Do I need any web.config changes other than TragetFramework settign while upgrading?
解决方案I had to upgrade my Unity to 3.5 due to my project's dependency on some other project and this error came again. This time, finally got it fixed.
This one helped me: devsilos.blogspot/2014/10/msb3268-while-targeting-aspnet-web-site.html
Solution I copied all the files that build was complaining about from:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facades
To
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2
Here's the explanation from the link above in case it goes down for any reason in future:
A deeper inspection revealed the following interesting fact: 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
As a result the whole thing failed since both System.Threading.Tasks and System.Runtime .dll-s were under the Facades directory and not inside the v4.5.
Now the solutions:
- Just simply copy the missing .dll-s from Facade to the v4.5 directory.
- Set the TargetFrameworkMoniker to 4.5.1 in the .sln file. The exact syntax is as follows: TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5.1".
What happens in this case is that the aspnet_compiler does not recognize the exact version of the required framework and tries to use the GAC wherever it can. If 4.5 is the highest version installed on the build machine I believe it should work.
更多推荐
依赖于框架程序集“ System.Runtime,Version = 4.0.10.0”。当前目标框架无法解决
发布评论