views:

100

answers:

1

I am trying to use svcutil to generate managed C++ code from XSD. The command line I am using is

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\xsd.exe" MyTest.xsd /classes /language:"Microsoft.VisualC.CppCodeProvider7, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /namespace:MyTestApp

However, I get error message as follows

Error: Value 'microsoft.visualc.cppcodeprovider7, cppcodeprovider, version=10.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' for switch /language is invalid. There is no codedom provider defined for the language.

I know that I have CppCodeProvider installed as part of Visual Studio install. I have also tried /language:cpp to no avail. I was able to generate code in C# without any issue for the same XSD.

Does anyone know what I am doing wrong?

+1  A: 

It is clearly stated in the MSDN Library article for svcutil.exe:

/language:<language>

Values: c#, cs, csharp, vb, visualbasic, c++, cpp

Default: csharp

Short form: /l

Note: The switch only supports C++ for the code provider that ships with Visual Studio 2005 SP1.

I think that came with the .NET 2.0 SDK back then. Not otherwise a problem, the language hasn't changed since then. Why not use csharp? Being able to painlessly mix languages in .NET is one of its great assets.

Hans Passant
We have a lot of code in unmanaged c++. We are in process of converting to managed (C# is the end goal). However, can't accept the cost of all or no change. Hence we need a way to make unmanaged calls.Doing interop using marshalling is very costly as we have large data structures (composites) that need to go back and forth. Instead of that, I want to take control of marshalling selectively (into just the required data structures). This works like adapter design pattern.Hence we need to use CIL.
Chetan
Note: The switch only supports C++ for the code provider that ships with Visual Studio 2005 SP1.Does that mean, I am forced to install Visual Studio 2005 SP1 to get the CPP code provider working?
Chetan