很长一段时间我都在使用VS 2012,目标是.net 4.0。代码是在TFS 2010构建代理上构建的,并且在安装了.net 4.0的计算机上运行良好。 好事总是走到尽头,我被迫在TFS 2010构建代理上安装.net 4.5。结果是我的应用程序在构建后需要在运行时使用.net 4.5。 在Windows XP上,应用程序无法启动并且不会显示错误。
为了调试这个,我启用了fuslog。我自己想要解决的唯一两件事就是将之前的构建与错误的构建进行比较(没有代码更改):
1)
System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.HTM
当没有.net 4.5的构建正在调用时
Calling assembly : System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
当使用.net 4.5进行构建时正在调用
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
2)错误的构建会生成其他文件:
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files\xyz\appName.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = AECA050416\fancyUser
LOG: DisplayName = appName.XmlSerializers, Version=2.2.407.51647, Culture=neutral, PublicKeyToken=306f64099261eabe, processorArchitecture=x86
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/xyz/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = appName.exe
Calling assembly : System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\xyz\appName.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: appName.XmlSerializers, Version=2.2.407.51647, Culture=neutral, PublicKeyToken=306f64099261eabe, processorArchitecture=x86
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).
你能说一下我的构建可能有什么问题吗? (我知道如果我卸载.net 4.5它会再次运行)
答案 0 :(得分:0)
过去我遇到了麻烦* .XmlSerializers.dll没有重新构建/生成/部署(沿着这些方向)。它是一个生成的程序集,与应用程序的主程序集/ DLL配对,可以降低序列化性能成本。
看看这是否可以作为一个简单的修复: