xsd.exe 似乎不适用于使用较新版本的 Visual Studio 的 C++ [英] xsd.exe does not seem to work for C++ with newer versions of Visual Studio
问题描述
我正在尝试使用 xsd.exe
工具从 XML 架构文件生成 C++ 类.根据这篇文章,我应该能够从Visual Studio 开发人员命令提示符,但它似乎不适用于较新版本的 Visual Studio(2017 或 2019)中的 C++
I am trying to use the xsd.exe
tool to generate C++ classes from XML schema files. According to this post I should simply be able to use the tool from a Visual Studio developer command prompt, but it doesn't seem to work for C++ in newer versions of Visual Studio (2017 or 2019)
当我尝试执行命令时出现错误:
When I try to execute the command I get the error:
错误:CodeDom 提供程序类型Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"无法定位.
Error: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located.
文档中似乎没有这方面的任何信息,谷歌搜索也没有帮助...有谁知道如何解决这个问题?
There doesn't seem to be any information on this in the documentation and a Google search was no help... Does anyone know how to solve this?
推荐答案
xsd.exe
在 VS 2017 中已弃用,并在 XSD 任务阅读:
xsd.exe
was deprecated in VS 2017, with a note under XSD Task reading:
从 Visual Studio 2017 开始,不推荐使用 xsd.exe
的 C++ 项目支持.您仍然可以通过手动将 CppCodeProvider.dll 添加到 GAC 来使用 Microsoft.VisualC.CppCodeProvider API.
Starting in Visual Studio 2017, C++ project support for
xsd.exe
is deprecated. You can still use the Microsoft.VisualC.CppCodeProvider APIs by manually adding CppCodeProvider.dll to the GAC.
这在微软批准的相关票证下的评论中得到证实 CppCodeProvider 未与 VS2017 正确安装,已被关闭为设计使然".
This was confirmed in Microsoft sanctioned comments under the related ticket CppCodeProvider not properly installed with VS2017, which was closed as "by design".
CppCodeProvider.dll
程序集,但是,继续与使用 C++ 进行桌面开发"一起发布.工作负载,并且仍然可以在 VS 2017 和 2019 中的 Common7\IDE\PublicAssemblies
目录下找到.可以使用全局程序集缓存工具将程序集添加到 GAC 中gacutil
命令提示符.
The CppCodeProvider.dll
assembly, however, continued to be released with the "Desktop development with C++" workload, and can still be found under the Common7\IDE\PublicAssemblies
directory in VS 2017 and 2019. The assembly can be added to the GAC using the global assembly cache tool gacutil
at a VS developer command prompt.
这篇关于xsd.exe 似乎不适用于使用较新版本的 Visual Studio 的 C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!