We developed an Isolated Shell Application based on VS 2013 shell and provided a project template for custom C++ projects.
We have an item template for adding .cpp & .h files to the project. When we try to add a .cpp / .h item, we are getting an error saying that VCCodeModel dll is not found. [ Could Not load file or Assembly Microsoft.VisualStudio.VCCodeModel Version=12.0.0.0 or one of its dependencies]
Also we tried to create a C++ project using File -> New Project Wizard, It failed with the same error. And then we did a work around and implemented IFilterTokenValues. But this particular workaround doesn't work when we try to add .h file /.cpp file using AddNewItem Wizard.
Following is our detailed observation after debugging
When we try to create a project using File->New Project Wizard, Shell calls Wizard.Execute() method in Microsoft.VisualStudio.TemplateWizard.dll - 12.0 and it in turn calls Wizard.CallFilterBasedOnExtension(). Based on the file type (in this case it is .cpp extension), This method (Wizard.CallFilterBasedOnExtension()) assumes that it is a .vcxproj and calls some method in CppFilterTokenValues class (IsReservedWord()) that requires "VCLanguageManager" object. "VCLanguageManager" object is provided by vcpkg.dll shipped with VisualStudio (Not with Shell). I guess the Interop DLL VCCodeModel.dll is also shipped with VisualStudio. It can be seen in VisualStudio Installation Folder. So this basically breaks the .h/.cpp file extension based project creation in a VS 2013 Isolated Shell Application.
If we implement IFilterTokenValues interface and register "VSIdentifierTranslatorAssembly" and "VSIdentifierTranslatorClass" keys in registry, CallFilterBasedOnExtension() extension method takes our own implementation of IFilterTokenValues and we can create a project using File->New Project Wizard. But we need to do the default handling that happens in Microsoft.VisualStudio.TemplateWizard.dll - 10.0 automatically (see Wizard.MakeNameCompliant()).
But this particular workaround doesn't work when we try to add .h file /.cpp file using AddNewItem Wizard. This time also Wizard.Execute() method in Microsoft.VisualStudio.TemplateWizard.dll is getting called and it calls CallFilterBasedOnExtension(). But this time first argument (project file extension) passed to CallFilterBasedOnExtension() is empty. So this method takes the second argument (file extension) as key to open the registry. But after selecting the key, it again validates (may be a bug) first argument (project file extension) and takes a different path and calls in to CppFilterTokenValues class. Please see Wizard.CallFilterBasedOnExtension() method in Microsoft.VisualStudio.TemplateWizard.dll
Please note that AddNewItem Wizard for .cpp / .h file works in VS 2010 based Isolated shell application. The behavior is changed because of the changes introduced in Microsoft.VisualStudio.TemplateWizard.dll 12.0 version.
How can I invoke my own IFilterTokenValues implemenation when I add new files using AddNewItem Wizard?
Is there any other way to solve this problem? Can somebody please suggest some way to solve this issue? (Preferably not doing anything as in VS 2010. Not even implementing IFilterTokenValues !!!)
Thanks
Jo