Can't add ATL object to CLR project

79 Views Asked by At

I am writing a COM wrapper for a managed C++ class within a C++ project. After adding one ATL Simple Object to my ATL project I then enabled Common Language Runtime Support (/clr) in the project properties, as required. However I now find that I am unable to add further ATL objects to my project - if I right-click the project and select Add and New Item the ATL option has disappeared from the list of Installed Visual C++ templates in the left-hand pane of the Add New Item dialog.

Is this a bug, or is there some good reason for it?

I will try turning off CLR, adding the classes and then turning on CLR again, hopefully this will work, but it seems a bit odd.

1

There are 1 best solutions below

0
Dave On

I think I'll answer this question myself - the answer, or rather the workaround, seems to be to turn off CLR support, add the ATL class(es) and turn CLR on again. If anyone can comes up with a good reason why Microsoft may have done this deliberately, and/or why this workaround doesn't/shouldn't work, please comment, otherwise let's assume it's just a little buglet.