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?
-
1From the documentation you linked to, it's in cppcodeprovider.dll - did you add a reference to that assembly?Jon Skeet– Jon Skeet2019-01-25 07:10:57 +00:00Commented Jan 25, 2019 at 7:10
-
nope,i not added itByte– Byte2019-01-25 07:16:09 +00:00Commented Jan 25, 2019 at 7:16
-
@JonSkeet post your answer as answer.Thanks for help!Byte– Byte2019-01-25 07:17:36 +00:00Commented Jan 25, 2019 at 7:17
1 Answer
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.