我有几个项目都包含json.net 6.0.3 NuGet包.当我添加:
using Newtonsoft.Json;
Run Code Online (Sandbox Code Playgroud)
构建时出现以下错误:
1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:未处理的异常(3.1.48.0,32位,CLR 4.5,发布):PostSharp.Sdk.CodeModel.AssemblyLoadException:找不到程序集'newtonsoft.json,version = 4.5. 0.0,culture = neutral,publickeytoken = 30ad4fe6b2a6aeed'.[版本不匹配] 1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:============ PostSharp程序集加载日志================ === 1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:使用绑定标识'newtonsoft.json,version = 4.5.0.0,culture = neutral,publickeytoken = 30ad4fe6b2a6aeed'查找程序集.1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:找到文件'F:\ packages\Newtonsoft.Json.6.0.3\lib \net45\Newtonsoft.Json.dll',标识为'newtonsoft.json,版本= 6.0.0.0,culture = neutral,publickeytoken = 30ad4fe6b2a6aeed,processorarchitecture = msil'.1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:参考不匹配'F:\ packages\Newtonsoft.Json.6.0.3\lib \net45\Newtonsoft.Json.dll'[VersionMismatch].1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:探测位置'C:\ ProgramData\PostSharp\3.1.48\bin.Release\Newtonsoft.Json.exe'因为此目录已明确添加到搜索路径[文件未找到].1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:探测位置'C:\ ProgramData\PostSharp\3.1.48\bin.Release\Newtonsoft.Json.dll'因为此目录已明确添加到搜索路径[文件未找到].1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:探测位置'C:\ ProgramData\PostSharp\3.1.48\bin.Release\Newtonsoft.Json.winmd'因为此目录已明确添加到搜索路径[文件未找到].1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:探测位置'F:\ bin\release\TwinkyTalk\Newtonsoft.Json.exe'因为此目录已明确添加到搜索路径[File Not Found].1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:找到文件'F:\ bin\release\TwinkyTalk\Newtonsoft.Json.dll',标识为'newtonsoft.json,version = 6.0.0.0,culture = neutral ,publickeytoken = 30ad4fe6b2a6aeed,processorarchitecture = msil'.1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:参考不匹配'F:\ bin\release\TwinkyTalk\Newtonsoft.Json.dll'[VersionMismatch].1> F:\ TwinkyTalk\TwinkyTalk.csproj:错误PS0099:日志:探测位置'F:\ bin\release\TwinkyTalk\Newtonsoft.Json.winmd'因为此目录已明确添加到搜索路径[File Not Found].1> …
我想让 fmt::format 从 EA 的 STL 返回一个 wstring,但是当我尝试从文档中修改此代码时 - 这工作正常:
// Prints formatted error message.
void
vreport_error(const char *format, fmt::format_args args) {
fmt::print("Error: ");
fmt::vprint(format, args);
}
template <typename... Args>
void
report_error(const char *format, const Args &... args) {
vreport_error(format, fmt::make_format_args(args...));
}
Run Code Online (Sandbox Code Playgroud)
使用 wchar_t 而不是 char:
// Prints formatted error message.
void vreport_error2(const wchar_t *format, fmt::format_args args);
template <typename... Args>
void
report_error2(const wchar_t *format, const Args &... args) {
vreport_error2(format, fmt::make_format_args(args...));
}
Run Code Online (Sandbox Code Playgroud)
我得到:
2>fmt\core.h(1219,1): error C2665: 'fmt::v5::basic_format_args<fmt::v5::wformat_context>::basic_format_args': none of the …Run Code Online (Sandbox Code Playgroud)