- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有几个项目都包含 json.net 6.0.3 NuGet 包。当我添加时:
using Newtonsoft.Json;
构建时出现以下错误:
1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: Unhandled exception (3.1.48.0, 32 bit, CLR 4.5, Release): PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot find assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed'. [Version mismatch] 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: ============ PostSharp Assembly Loading Log =================== 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Finding the assembly with binding identity 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed'. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Found file 'F:\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll' with identity 'newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed, processorarchitecture=msil'. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Reference mismatch for 'F:\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll' [VersionMismatch]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\ProgramData\PostSharp\3.1.48\bin.Release\Newtonsoft.Json.exe' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\ProgramData\PostSharp\3.1.48\bin.Release\Newtonsoft.Json.dll' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\ProgramData\PostSharp\3.1.48\bin.Release\Newtonsoft.Json.winmd' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'F:\bin\release\TwinkyTalk\Newtonsoft.Json.exe' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Found file 'F:\bin\release\TwinkyTalk\Newtonsoft.Json.dll' with identity 'newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed, processorarchitecture=msil'. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Reference mismatch for 'F:\bin\release\TwinkyTalk\Newtonsoft.Json.dll' [VersionMismatch]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'F:\bin\release\TwinkyTalk\Newtonsoft.Json.winmd' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'F:\TwinkyTalk\obj\Release\Newtonsoft.Json.exe' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'F:\TwinkyTalk\obj\Release\Newtonsoft.Json.dll' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'F:\TwinkyTalk\obj\Release\Newtonsoft.Json.winmd' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Newtonsoft.Json.exe' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Newtonsoft.Json.dll' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Newtonsoft.Json.winmd' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\Newtonsoft.Json.exe' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\Newtonsoft.Json.dll' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\Facades\Newtonsoft.Json.winmd' because this directory was explicitly added to the search path [File Not Found]. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Looking in GAC for Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=x86. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Looking in GAC for Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=msil. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: Looking in GAC for Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: LOG: The assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed' was not found. 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: =============================================================== 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName, BindingOptions bindingOptions) 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.^5YpB0scd(BindingOptions _0) 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^SgrhoGlQ(AssemblyRefDeclaration _0) 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^+GwnKh4ZYHu3() 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.Execute() 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase) 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Sdk.Extensibility.Project.Execute() 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Hosting.PostSharpObject.ExecuteProjects() 1>F:\TwinkyTalk\TwinkyTalk.csproj : error PS0099: at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation).
我无法在项目中找到对“'newtonsoft.json,version=4.5.0.0”的任何引用,不确定为什么要查找它。
我尝试将“Build Host”PostSharp 项目属性设置为托管,但仍然遇到相同的异常。
最佳答案
当某些第 3 方库引用旧版本的程序集(在本例中为 Newtonsoft.Json)时,通常会发生这种情况。通过在 web.config/app.config 文件中指定绑定(bind)重定向来解决该问题。
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0"/>
</dependentAssembly>
但是,您还需要告诉 PostSharp 到哪里寻找绑定(bind)重定向配置。您可以通过在 *.csproj 文件中设置 PostSharpHostConfigurationFile 属性来执行此操作:
<PropertyGroup>
<PostSharpHostConfigurationFile>web.config</PostSharpHostConfigurationFile>
</PropertyGroup>
关于 SO ( PostSharp AssemblyLoadException Autofac ) 还有一个类似的问题,还有一个 relevant blog post .
关于json.net - 发布版本中 PostSharp 中的 AssemblyLoadException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25798212/
我正在设置一个新的解决方案,我想在其中使用最新的 Autofac (3.4) 和 PostSharp 3.1.42。引用 NuGet 包后出现以下错误,我无法弄清楚发生了什么。我从未选择 Autofa
我有几个项目都包含 json.net 6.0.3 NuGet 包。当我添加时: using Newtonsoft.Json; 构建时出现以下错误: 1>F:\TwinkyTalk\TwinkyTalk
我刚开始使用 postsharp/AOP。我想为 C# 制作一些工具来跟踪我为某个软件编写的一些插件的使用情况。 我正在尝试使用 OnMethodBoundaryAspect 类来记录调用方法时某些参
我是一名优秀的程序员,十分优秀!