xsd.exe does not seem to work for C++ with newer versions of Visual Studio

江枫思渺然 提交于 2021-01-28 08:08:29

问题


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:

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?


回答1:


xsd.exe was deprecated in VS 2017, with a note under XSD Task reading:

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.

This was confirmed in Microsoft sanctioned comments under the related ticket CppCodeProvider not properly installed with VS2017, which was closed as "by design".

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.



来源:https://stackoverflow.com/questions/65658816/xsd-exe-does-not-seem-to-work-for-c-with-newer-versions-of-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!