Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

AddNewItem Wizard Bug - VS 2013 Isolated Shell Application (C++ Project)

$
0
0

We have an Isolated Shell Application based on VS 2013 shell. We have a project template for C/C++ projects and the template wizard calls Wizard.Execute() method in Microsoft.VisualStudio.TemplateWizard.dll - 12.0 and it calls Wizard.CallFilterBasedOnExtension(). Based on the file type (in this case it is .cpp extension), This method 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. (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 this 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 (may be from Microsoft) suggest some way to solve this issue?  (Preferably not doing anything like in VS 2010)

Thanks

Jo




Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>