从postsharp 2.1.7升级到4.1.3导致MVC 5的参考和目标问题



我在MVC 5上遇到了postsharp 4的问题,在卸载posharp 2.1并从c# MVC项目中移除并安装了postsharp 4后,无法完成和构建项目,visual studio 2015无法找到postsharp 4的目标。

未处理的异常(4.1.24.0,postsharp.srv.4.0-x86.exe, CLR4.0.30319.393295, Release): postsharp . sdk . codemodel . assemblyloadeexception: Cannot find assembly'postsharp, version=2.1.0.0, culture=neutral,都必须b13fd38b8f9c99d7"。(版本不匹配 ]============PostSharp组装加载日志 =================== 日志:找到绑定id为postsharp的程序集,version=2.1.0.0,文化=中立,都必须b13fd38b8f9c99d7"。

但是为什么它想要post - tharp 2.1.0.0版本,因为它不再在项目中了,我清理了引用和所有以前的文件,所以只有版本4在项目中。

我在VS 2015中得到了这个错误报告:(有点长…)

未处理的异常(4.1.24.0,postsharp.srv.4.0-x86.exe, CLR4.0.30319.393295, Release): postsharp . sdk . codemodel . assemblyloadeexception: Cannot find assembly'postsharp, version=2.1.0.0, culture=neutral,都必须b13fd38b8f9c99d7"。(版本不匹配 ]============PostSharp组装加载日志 =================== 日志:找到绑定id为postsharp的程序集,version=2.1.0.0,culture=neutral, publickeytoken=b13fd38b8f9c99d7'.LOG:探测文件"C:ProgramDataPostSharp4.1.24bin.ReleasePostSharp.dll",因为它在AppDomain.LOG: Assembly 'PostSharp, Version=4.1.24.0,文化=中性,PublicKeyToken=b13fd38b8f9c99d7'不匹配找到文件"项目"包 PostSharp.4.1.24 lib net35-client PostSharp.dll"身份后尖锐,版本=4.1.24.0,文化=中性,都必须b13fd38b8f9c99d7, processorarchitecture = msil ' . log:项目的引用不匹配"包 PostSharp.4.1.24 lib net35-client PostSharp.dll '[VersionMismatch].LOG:探测位置"C: ProgramData PostSharp 4.1.24 bin.Release PostSharp.exe的因为这个目录被显式地添加到搜索路径[File Not]log:找到的文件"C: ProgramData PostSharp 4.1.24 bin.Release PostSharp.dll"身份后尖锐,版本=4.1.24.0,文化=中性,都必须b13fd38b8f9c99d7, processorarchitecture = msil ' . log:引用不匹配"C: ProgramData PostSharp 4.1.24 bin.Release PostSharp.dll"[VersionMismatch].LOG:探测位置"C: ProgramData PostSharp 4.1.24 bin.Release PostSharp。winmd",因为这个目录被显式地添加到搜索路径[File Not][发现].LOG:探测位置'"PROJECT PLACE"binPostSharp.exe'因为这个目录被显式地添加到搜索路径[File].LOG:找到文件"PROJECT PLACE"binPostSharp.dll身份后尖锐,版本=4.1.24.0,文化=中性,都必须b13fd38b8f9c99d7, processorarchitecture = msil ' . log:"PROJECT PLACE"binPostSharp.dll的引用不匹配[VersionMismatch].LOG:探测位置' ' '项目地方" bin PostSharp。Winmd ',因为这个目录是显式的添加到搜索路径[File Not Found].LOG:探测位置'"项目位置"objDebugPostSharp.exe',因为这个目录是明确地添加到搜索路径[File Not Found].LOG: Probing位置'"项目地点"objDebugPostSharp.dll',因为这目录被显式添加到搜索路径[File Not .[发现].LOG:探测位置'"项目地方" obj PostSharp调试。Winmd ',因为这个目录是明确地添加到搜索路径[File Not Found].LOG: Probinglocation 'C:Program Files (x86)Reference微软组件 Framework.NETFramework v4.5开发 PostSharp.exe"因为这个目录被显式地添加到搜索路径[File][未找到].LOG:探测位置'C:Program Files (x86)Reference微软组件 Framework.NETFramework v4.5开发 PostSharp.dll"因为这个目录被显式地添加到搜索路径[File][未找到].LOG:探测位置'C:Program Files (x86)Reference微软组件 Framework.NETFramework v4.5开发 PostSharp.winmd"因为这个目录被显式地添加到搜索路径[File][未找到].LOG:探测位置'C:Program Files (x86)Reference微软组件 Framework.NETFramework v4.5开发外墙 PostSharp.exe '因为这个目录被显式地添加到搜索路径[File][未找到].LOG:探测位置'C:Program Files (x86)Reference微软组件 Framework.NETFramework v4.5开发外墙 PostSharp.dll '因为这个目录被显式地添加到搜索路径[File][未找到].LOG:探测位置'C:Program Files (x86)Reference微软组件 Framework.NETFramework v4.5开发外墙 PostSharp.winmd '因为这个目录被显式地添加到搜索路径[File]在GAC中查找PostSharp, Version=2.1.0.0,文化=中立,都必须b13fd38b8f9c99d7,processorArchitecture=x86.LOG:在GAC中寻找PostSharp,版本=2.1.0.0,文化=中性,PublicKeyToken=b13fd38b8f9c99d7,processorArchitecture=msil.LOG:在GAC中寻找PostSharp,版本=2.1.0.0,文化=中性,PublicKeyToken=b13fd38b8f9c99d7.LOG:程序集的postsharp, version=2.1.0.0, culture=neutral,Publickeytoken =b13fd38b8f9c99d7'没有发现 .===============================================================PostSharp.Sdk.CodeModel.Domain.GetAssembly (IAssemblyNameassemblyName, BindingOptions BindingOptions, AssemblyLoadContext上下文)PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope (BindingOptionsbindingOptions)PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition (BindingOptionsbindingOptions)PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition ()PostSharp.Sdk.CodeModel.CompareExtensions。^ G + gKPm9V (INamedType _0,INamedType _1, BindingOptions _2) atPostSharp.Sdk.CodeModel.CompareExtensions.DefinitionMatchesReference (INamedType定义,INamedType引用,BindingOptions选项)PostSharp.Sdk.CodeModel.TypeRefDeclaration。^ A9yFoe2uB3TC (ITypeSignature_0, BindingOptions _1)在PostSharp.Sdk.CodeModel.TypeRefDeclaration.MatchesReference(typeesignature .参考)PostSharp.Sdk.CodeModel.Collections.CustomAttributeDeclarationCollection.Contains (IType类型)PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask。^ SgrhoGlQ (AssemblyRefDeclaration_0) at postsharp . sdk . extension . tasks . multicastattributetask .^+GwnKh4ZYHu3()在PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.Execute ()在PostSharp.Sdk.Extensibility.Project。ExecutePhase(字符串阶段)atPostSharp.Sdk.Extensibility.Project.Execute ()PostSharp.Hosting.PostSharpObject.ExecuteProjects ()PostSharp.Hosting.PostSharpObject.InvokeProject (ProjectInvocationprojectInvocation)。

但是Public KeyToken是正确的,dll在那里,只是不是正确的。我已经清理了packages文件夹,以便从vs中恢复它,但它只恢复坏的dll。如果有人能帮助我,那就太好了,因为我想从我的mvc项目的后期升级。

Thanks in advanced.

右键单击项目并单击"Manage NuGet packages…"。搜索Postsharp,然后重新安装。

如果这不起作用,尝试将其添加到app.config:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="PostSharp" publicKeyToken="b13fd38b8f9c99d7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.24.0" newVersion="4.1.24.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

最新更新