When starting up my web site for the first time, I'm getting this error
当我第一次启动我的网站时,我得到了这个错误。
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
无法加载类型的system . runtime.compile服务。mscorlib中的ExtensionAttribute,版本=4.0.0.0,Culture=中性,PublicKeyToken=b77a5c561934e089'
What am I doing wrong?
我做错了什么?
I am using .NET 4 and am starting the site from Visual Studio.
我使用。net 4,从Visual Studio开始网站。
The only thing I've changed recently is add Simple Injector (via Nuget) into my project.
我最近唯一改变的是在我的项目中添加简单的注射器(通过Nuget)。
Here's the stack trace
这是堆栈跟踪
[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192
System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +115
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +426
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit) +64
WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +132
WebActivator.ActivationManager.RunActivationMethods() +216
WebActivator.ActivationManager.RunPreStartMethods() +43
WebActivator.ActivationManager.Run() +69
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +423
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
The first line of all views get highlighted and when you hover over them you get this error
所有视图的第一行都被高亮显示,当您将鼠标悬停在它们上面时,就会得到这个错误。
The pre-application start initialisation method Run on type WebActivator.ActivationManager threw an exception with the following error message Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
10 个解决方案
#1
244
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly mscorlib
无法加载类型的system . runtime.compile服务。从装配mscorlib ExtensionAttribute”
Yes, this technically can go wrong when you execute code on .NET 4.0 instead of .NET 4.5. The attribute was moved from System.Core.dll to mscorlib.dll in .NET 4.5. While that sounds like a rather nasty breaking change in a framework version that is supposed to be 100% compatible, a [TypeForwardedTo] attribute is supposed to make this difference unobservable.
是的,当你在。net 4.0而不是。net 4.0中执行代码时,这个技术可能会出错。该属性从System.Core移出。mscorlib dll。dll在。net 4.5。虽然这听起来像是一个框架版本的一个相当糟糕的破断变化,应该是100%兼容的,但是一个[TypeForwardedTo]属性应该会使这个差异不可见。
As Murphy would have it, every well intended change like this has at least one failure mode that nobody thought of. This appears to go wrong when ILMerge was used to merge several assemblies into one and that tool was used incorrectly. A good feedback article that describes this breakage is here. It links to a blog post that describes the mistake. It is rather a long article, but if I interpret it correctly then the wrong ILMerge command line option causes this problem:
正如墨菲所言,每一个精心准备的改变都至少有一个没有人想到的失败模式。当使用ILMerge将多个程序集合并为一个,而该工具被错误地使用时,这种情况似乎会出错。一个好的反馈文章描述了这个破损。它链接到一个描述错误的博客文章。这是一篇很长的文章,但是如果我正确地解释它,那么错误的ILMerge命令行选项会导致这个问题:
/targetplatform:"v4,c:\windows\Microsoft.NET\Framework\v4.0.30319"
Which is incorrect. When you install 4.5 on the machine that builds the program then the assemblies in that directory are updated from 4.0 to 4.5 and are no longer suitable to target 4.0. Those assemblies really shouldn't be there anymore but were kept for compat reasons. The proper reference assemblies are the 4.0 reference assemblies, stored elsewhere:
这是不正确的。当您在构建程序的机器上安装4.5时,该目录中的程序集将从4.0升级到4.5,不再适用于目标4.0。那些集会真的不应该出现在那里,但被保留的原因。适当的参考程序集是4.0引用程序集,存储在其他地方:
/targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
So possible workarounds are to fall back to 4.0 on the build machine, install .NET 4.5 on the target machine and the real fix, to rebuild the project from the provided source code, fixing the ILMerge command.
因此,可能的解决方案是在构建机器上退回到4.0,在目标机器上安装。net 4.5,并真正修复,从提供的源代码中重新构建项目,修复ILMerge命令。
Do note that this failure mode isn't exclusive to ILMerge, it is just a very common case. Any other scenario where these 4.5 assemblies are used as reference assemblies in a project that targets 4.0 is liable to fail the same way. Judging from other questions, another common failure mode is in build servers that were setup without using a valid VS license. And overlooking that the multi-targeting packs are a free download.
请注意,这种失败模式并不是ILMerge独有的,它只是一个非常普通的例子。如果在一个目标4.0的项目中使用这4.5个程序集作为参考程序集,那么任何其他场景都可能以同样的方式失败。从其他问题判断,另一个常见的故障模式是在构建服务器时不使用有效的VS许可。可以忽略的是,多目标包是免费下载的。
Using the reference assemblies in the c:\program files (x86) subdirectory is a rock hard requirement. Starting at .NET 4.0, already important to avoid accidentally taking a dependency on a class or method that was added in the 4.01, 4.02 and 4.03 releases. But absolutely essential now that 4.5 is released.
在c:\程序文件(x86)子目录中使用引用程序集是一个非常困难的要求。从。net 4.0开始,对于避免意外地依赖于在4.01、4.02和4.03版本中添加的类或方法,已经很重要了。但是现在,4.5的释放是绝对必要的。
#2
8
I had this problem, except the type it couldn't load was System.Reflection.AssemblyMetadataAttribute. The web application was built on a machine with .NET 4.5 installed (runs fine there), with 4.0 as the target framework, but the error presented itself when it was run on a web server with only 4.0 installed. I then tried it on a web server with 4.5 installed and there was no error. So, as others have said, this is all due to the screwy way Microsoft released 4.5, which basically is an upgrade to (and overwrite of) version 4.0. The System.Reflection assembly references a type that doesn't exist in 4.0 (AssemblyMetadataAttribute) so it will fail if you don't have the new System.Reflection.dll.
我遇到了这个问题,除了它不能加载的类型是system . reflection.installymetadataattribute。web应用程序是在一个安装了. net 4.5的机器上构建的(运行良好),以4.0作为目标框架,但是当它在仅安装了4.0的web服务器上运行时出现了错误。然后我在一个安装了4.5的web服务器上进行了测试,并且没有出现错误。所以,就像其他人说的,这都是由于微软发布了4.5版本,基本上是升级到4.0版本。这个系统。反射程序集引用了一个在4.0中不存在的类型(assembly - metadataattribute),如果没有新的System.Reflection.dll,它就会失败。
You can either install .NET 4.5 on the target web server, or build the application on a machine that does not have 4.5 installed. Far from an ideal resolution.
您可以在目标web服务器上安装. net 4.5,或者在没有安装4.5的机器上构建应用程序。这远非一个理想的解决方案。
#3
7
I had this exact same problem with a site (Kentico CMS), starting development in 4.5, finding out the production server only supports 4.0, tried going back down to target framework of 4.0. Compiling the other posts in this thread (specifically changing target framework to .Net 4 and .Net 4.5 still being referenced). I searched through my solution and found that a handful of the NuGet packages were still using libraries with targetFramework="net45".
我和一个网站(Kentico CMS)有同样的问题,从4.5开始开发,发现生产服务器只支持4.0,尝试回到4.0的目标框架。在这个线程中编译其他的帖子(特别是将目标框架更改为。net 4和。net 4.5仍然被引用)。我搜索了一下我的解决方案,发现一些NuGet包仍然在使用带有targetFramework="net45"的库。
packages.config (before):
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.1.0" targetFramework="net45" />
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
</packages>
I changed the projects target framework back to 4.5, removed all NuGet libraries, went back down to 4.0 and re-added the libraries (had to use some previous versions that were not dependent on 4.5).
我将项目目标框架更改为4.5,删除了所有的NuGet库,返回到4.0并重新添加了库(必须使用以前不依赖于4.5的版本)。
packages.config (after):
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.1.1" targetFramework="net40" />
<package id="EntityFramework" version="6.0.2" targetFramework="net40" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
</packages>
#4
4
I just ran into this annoying problem today. We use SmartAssembly to pack/obfuscate our .NET assemblies, but suddenly the final product wasn't working on our test systems. I didn't even think I had .NET 4.5, but apparently something installed it about a month ago.
我今天遇到了这个烦人的问题。我们使用SmartAssembly来包装/混淆我们的。net程序集,但是突然之间,最终的产品并没有在我们的测试系统上运行。我甚至不认为我有。net 4.5,但显然是一个月前安装的。
I uninstalled 4.5 and reinstalled 4.0, and now everything is working again. Not too impressed with having blown an afternoon on this.
我卸载了4.5,重新安装了4.0,现在一切又恢复正常了。在这个问题上度过了一个下午,我并不太在意。
#5
3
I did encounter the same problem while trying to read data from a Firebird Database. After many hours of searching, I found out that the problem was caused by an error I made in the query. Fixing it made it work perfectly. It had nothing to do with the version of the Framework
在尝试从Firebird数据库读取数据时,我遇到了同样的问题。经过长时间的搜索,我发现问题是由我在查询中犯的错误引起的。修理它使它工作得很完美。它与框架的版本没有任何关系。
#6
2
We ran into this problem and tracked it down to the Geocoding.net NuGet package that we were using to help with our Google Maps views (Geocoding.net version 3.1.0 published 2/4/2014).
我们遇到了这个问题,并将其跟踪到Geocoding.net NuGet包中,我们用它来帮助我们的谷歌地图视图(Geocoding.net版本3.1.0发布了2/4/2014)。
The Geocoding dll appears to be .Net 4.0 when you examine the package file or view it using Jet Brains’ Dot Peek application; however, a colleague of mine says that it was compiled using ilmerge so it is most likely related to the ilmerge problems listed above.
当您检查包文件或使用Jet brain ' Dot Peek应用程序查看包文件时,地理编码dll似乎是。net 4.0;但是,我的一个同事说它是用ilmerge编译的,所以它很可能与上面列出的ilmerge问题有关。
It was a long process to track it down. We fetched different changesets from TFS till we narrowed it down to the changeset that added the aforementioned NuGet package. After removing it, we were able to deploy to our .NET 4 server.
这是一个漫长的过程。我们从TFS获取不同的变更集,直到将其缩小到添加上述NuGet包的变更集。删除后,我们可以部署到。net 4服务器。
#7
1
In my case after downgrading from .NET 4.5 to .NET 4.0 project was working fine on a local machine, but was failing on server after publishing.
在我的案例中,从。net 4.5降级到。net 4.0的项目在本地机器上运行良好,但在发布后却失败了。
Turns out that destination had some old assemblies, which were still referencing .NET 4.5.
结果显示,目的地有一些旧的程序集,它们仍然引用。net 4.5。
Fixed it by enabling publishing option "Delete all existing files prior to publish"
通过启用发布选项修复它,“在发布之前删除所有现有文件”
#8
0
In my case, it was Blend SDK missed out on TeamCity machine. This caused the error due incorrect way of assembly resolving then.
在我的例子中,是Blend SDK错过了TeamCity机器。这导致了错误的装配解决方法。
#9
0
Just adding this answer to help Google save some punter the hours I have spent to get here. I used ILMerge on my .Net 4.0 project, without the /targetplatform option set, assuming it would be detected correctly from my main assembly. I then had complaints from users only on Windows XP aka WinXP. This now makes sense as XP will never have > .Net 4.0 installed whereas most newer OSes will. So if your XP users are having issues, see the fixes above.
只要加上这个答案,帮助谷歌省下一些我花在这里的时间。我在。net 4.0项目中使用了ILMerge,没有了/targetplatform选项集,假设它可以从我的主程序集正确地检测到。然后我只在Windows XP中有用户抱怨。这是有意义的,因为XP永远不会安装>。net 4.0,而大多数新的OSes将会安装。因此,如果您的XP用户有问题,请参见上面的补丁。
#10
0
In my case I had an issue around using Microsoft.ReportViewer.WebForms. I removed validate=true from add verb
line in web.config and it started working:
在我的例子中,我有一个使用Microsoft.ReportViewer.WebForms的问题。我从web上的add verb行中删除了validate=true。config and it started working:
<system.web>
<httpHandlers>
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
#1
244
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly mscorlib
无法加载类型的system . runtime.compile服务。从装配mscorlib ExtensionAttribute”
Yes, this technically can go wrong when you execute code on .NET 4.0 instead of .NET 4.5. The attribute was moved from System.Core.dll to mscorlib.dll in .NET 4.5. While that sounds like a rather nasty breaking change in a framework version that is supposed to be 100% compatible, a [TypeForwardedTo] attribute is supposed to make this difference unobservable.
是的,当你在。net 4.0而不是。net 4.0中执行代码时,这个技术可能会出错。该属性从System.Core移出。mscorlib dll。dll在。net 4.5。虽然这听起来像是一个框架版本的一个相当糟糕的破断变化,应该是100%兼容的,但是一个[TypeForwardedTo]属性应该会使这个差异不可见。
As Murphy would have it, every well intended change like this has at least one failure mode that nobody thought of. This appears to go wrong when ILMerge was used to merge several assemblies into one and that tool was used incorrectly. A good feedback article that describes this breakage is here. It links to a blog post that describes the mistake. It is rather a long article, but if I interpret it correctly then the wrong ILMerge command line option causes this problem:
正如墨菲所言,每一个精心准备的改变都至少有一个没有人想到的失败模式。当使用ILMerge将多个程序集合并为一个,而该工具被错误地使用时,这种情况似乎会出错。一个好的反馈文章描述了这个破损。它链接到一个描述错误的博客文章。这是一篇很长的文章,但是如果我正确地解释它,那么错误的ILMerge命令行选项会导致这个问题:
/targetplatform:"v4,c:\windows\Microsoft.NET\Framework\v4.0.30319"
Which is incorrect. When you install 4.5 on the machine that builds the program then the assemblies in that directory are updated from 4.0 to 4.5 and are no longer suitable to target 4.0. Those assemblies really shouldn't be there anymore but were kept for compat reasons. The proper reference assemblies are the 4.0 reference assemblies, stored elsewhere:
这是不正确的。当您在构建程序的机器上安装4.5时,该目录中的程序集将从4.0升级到4.5,不再适用于目标4.0。那些集会真的不应该出现在那里,但被保留的原因。适当的参考程序集是4.0引用程序集,存储在其他地方:
/targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
So possible workarounds are to fall back to 4.0 on the build machine, install .NET 4.5 on the target machine and the real fix, to rebuild the project from the provided source code, fixing the ILMerge command.
因此,可能的解决方案是在构建机器上退回到4.0,在目标机器上安装。net 4.5,并真正修复,从提供的源代码中重新构建项目,修复ILMerge命令。
Do note that this failure mode isn't exclusive to ILMerge, it is just a very common case. Any other scenario where these 4.5 assemblies are used as reference assemblies in a project that targets 4.0 is liable to fail the same way. Judging from other questions, another common failure mode is in build servers that were setup without using a valid VS license. And overlooking that the multi-targeting packs are a free download.
请注意,这种失败模式并不是ILMerge独有的,它只是一个非常普通的例子。如果在一个目标4.0的项目中使用这4.5个程序集作为参考程序集,那么任何其他场景都可能以同样的方式失败。从其他问题判断,另一个常见的故障模式是在构建服务器时不使用有效的VS许可。可以忽略的是,多目标包是免费下载的。
Using the reference assemblies in the c:\program files (x86) subdirectory is a rock hard requirement. Starting at .NET 4.0, already important to avoid accidentally taking a dependency on a class or method that was added in the 4.01, 4.02 and 4.03 releases. But absolutely essential now that 4.5 is released.
在c:\程序文件(x86)子目录中使用引用程序集是一个非常困难的要求。从。net 4.0开始,对于避免意外地依赖于在4.01、4.02和4.03版本中添加的类或方法,已经很重要了。但是现在,4.5的释放是绝对必要的。
#2
8
I had this problem, except the type it couldn't load was System.Reflection.AssemblyMetadataAttribute. The web application was built on a machine with .NET 4.5 installed (runs fine there), with 4.0 as the target framework, but the error presented itself when it was run on a web server with only 4.0 installed. I then tried it on a web server with 4.5 installed and there was no error. So, as others have said, this is all due to the screwy way Microsoft released 4.5, which basically is an upgrade to (and overwrite of) version 4.0. The System.Reflection assembly references a type that doesn't exist in 4.0 (AssemblyMetadataAttribute) so it will fail if you don't have the new System.Reflection.dll.
我遇到了这个问题,除了它不能加载的类型是system . reflection.installymetadataattribute。web应用程序是在一个安装了. net 4.5的机器上构建的(运行良好),以4.0作为目标框架,但是当它在仅安装了4.0的web服务器上运行时出现了错误。然后我在一个安装了4.5的web服务器上进行了测试,并且没有出现错误。所以,就像其他人说的,这都是由于微软发布了4.5版本,基本上是升级到4.0版本。这个系统。反射程序集引用了一个在4.0中不存在的类型(assembly - metadataattribute),如果没有新的System.Reflection.dll,它就会失败。
You can either install .NET 4.5 on the target web server, or build the application on a machine that does not have 4.5 installed. Far from an ideal resolution.
您可以在目标web服务器上安装. net 4.5,或者在没有安装4.5的机器上构建应用程序。这远非一个理想的解决方案。
#3
7
I had this exact same problem with a site (Kentico CMS), starting development in 4.5, finding out the production server only supports 4.0, tried going back down to target framework of 4.0. Compiling the other posts in this thread (specifically changing target framework to .Net 4 and .Net 4.5 still being referenced). I searched through my solution and found that a handful of the NuGet packages were still using libraries with targetFramework="net45".
我和一个网站(Kentico CMS)有同样的问题,从4.5开始开发,发现生产服务器只支持4.0,尝试回到4.0的目标框架。在这个线程中编译其他的帖子(特别是将目标框架更改为。net 4和。net 4.5仍然被引用)。我搜索了一下我的解决方案,发现一些NuGet包仍然在使用带有targetFramework="net45"的库。
packages.config (before):
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.1.0" targetFramework="net45" />
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
</packages>
I changed the projects target framework back to 4.5, removed all NuGet libraries, went back down to 4.0 and re-added the libraries (had to use some previous versions that were not dependent on 4.5).
我将项目目标框架更改为4.5,删除了所有的NuGet库,返回到4.0并重新添加了库(必须使用以前不依赖于4.5的版本)。
packages.config (after):
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.1.1" targetFramework="net40" />
<package id="EntityFramework" version="6.0.2" targetFramework="net40" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
</packages>
#4
4
I just ran into this annoying problem today. We use SmartAssembly to pack/obfuscate our .NET assemblies, but suddenly the final product wasn't working on our test systems. I didn't even think I had .NET 4.5, but apparently something installed it about a month ago.
我今天遇到了这个烦人的问题。我们使用SmartAssembly来包装/混淆我们的。net程序集,但是突然之间,最终的产品并没有在我们的测试系统上运行。我甚至不认为我有。net 4.5,但显然是一个月前安装的。
I uninstalled 4.5 and reinstalled 4.0, and now everything is working again. Not too impressed with having blown an afternoon on this.
我卸载了4.5,重新安装了4.0,现在一切又恢复正常了。在这个问题上度过了一个下午,我并不太在意。
#5
3
I did encounter the same problem while trying to read data from a Firebird Database. After many hours of searching, I found out that the problem was caused by an error I made in the query. Fixing it made it work perfectly. It had nothing to do with the version of the Framework
在尝试从Firebird数据库读取数据时,我遇到了同样的问题。经过长时间的搜索,我发现问题是由我在查询中犯的错误引起的。修理它使它工作得很完美。它与框架的版本没有任何关系。
#6
2
We ran into this problem and tracked it down to the Geocoding.net NuGet package that we were using to help with our Google Maps views (Geocoding.net version 3.1.0 published 2/4/2014).
我们遇到了这个问题,并将其跟踪到Geocoding.net NuGet包中,我们用它来帮助我们的谷歌地图视图(Geocoding.net版本3.1.0发布了2/4/2014)。
The Geocoding dll appears to be .Net 4.0 when you examine the package file or view it using Jet Brains’ Dot Peek application; however, a colleague of mine says that it was compiled using ilmerge so it is most likely related to the ilmerge problems listed above.
当您检查包文件或使用Jet brain ' Dot Peek应用程序查看包文件时,地理编码dll似乎是。net 4.0;但是,我的一个同事说它是用ilmerge编译的,所以它很可能与上面列出的ilmerge问题有关。
It was a long process to track it down. We fetched different changesets from TFS till we narrowed it down to the changeset that added the aforementioned NuGet package. After removing it, we were able to deploy to our .NET 4 server.
这是一个漫长的过程。我们从TFS获取不同的变更集,直到将其缩小到添加上述NuGet包的变更集。删除后,我们可以部署到。net 4服务器。
#7
1
In my case after downgrading from .NET 4.5 to .NET 4.0 project was working fine on a local machine, but was failing on server after publishing.
在我的案例中,从。net 4.5降级到。net 4.0的项目在本地机器上运行良好,但在发布后却失败了。
Turns out that destination had some old assemblies, which were still referencing .NET 4.5.
结果显示,目的地有一些旧的程序集,它们仍然引用。net 4.5。
Fixed it by enabling publishing option "Delete all existing files prior to publish"
通过启用发布选项修复它,“在发布之前删除所有现有文件”
#8
0
In my case, it was Blend SDK missed out on TeamCity machine. This caused the error due incorrect way of assembly resolving then.
在我的例子中,是Blend SDK错过了TeamCity机器。这导致了错误的装配解决方法。
#9
0
Just adding this answer to help Google save some punter the hours I have spent to get here. I used ILMerge on my .Net 4.0 project, without the /targetplatform option set, assuming it would be detected correctly from my main assembly. I then had complaints from users only on Windows XP aka WinXP. This now makes sense as XP will never have > .Net 4.0 installed whereas most newer OSes will. So if your XP users are having issues, see the fixes above.
只要加上这个答案,帮助谷歌省下一些我花在这里的时间。我在。net 4.0项目中使用了ILMerge,没有了/targetplatform选项集,假设它可以从我的主程序集正确地检测到。然后我只在Windows XP中有用户抱怨。这是有意义的,因为XP永远不会安装>。net 4.0,而大多数新的OSes将会安装。因此,如果您的XP用户有问题,请参见上面的补丁。
#10
0
In my case I had an issue around using Microsoft.ReportViewer.WebForms. I removed validate=true from add verb
line in web.config and it started working:
在我的例子中,我有一个使用Microsoft.ReportViewer.WebForms的问题。我从web上的add verb行中删除了validate=true。config and it started working:
<system.web>
<httpHandlers>
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />