Search code examples
c#compilationcodedomcsharpcodeprovider

c# - Microsoft.VisualC.CppCodeProvider missing


I wanted to compile c++ code at runtime in c# application.To compile c# code in c# application,i used CSharpCodeProvider(CodeDom).So,now i want to compile c++ code,i checked some resources,topics,and all of them says,to compile c++ code,i need to use CppCodeProvider,so,its in Microsoft.VisualC namespace,i found Microsoft.VisualC.dll,and imported to my project.When i tried to use CppCodeProvider,its not found.There is no CppCodeProvider in Microsoft.VisualC. Help me please.Where i need to find CppCodeProvider?


Solution

  • It's in the cppcodeprovider.dll assembly - that's the one you need to add a reference to.

    In general, the way to work out what reference you need is to look at the documentation and check the "assembly" part under the namespace. Often you can guess (e.g. if it's in an assembly with the same name as the namespace) but if you ever get stuck, the documentation is the way to go.

    I note, however, that this API isn't listed in the more modern .NET documentation. I don't know whether that means it's gone away or been deprecated, but it's at least work being aware of. I can't see a NuGet package providing the functionality either.