January 21, 2020 at 20:34 #27186
In version 5.1, Linux project templates had the ability to name files like “$$PROJECTNAMEBASE$$.cpp” that would be named with the project name in the resulting project directory. Also, the files themselves could have textual replacements done so “$$PROJECTNAMEBASE_CPPID$$” would also get replaced with the project name. None of this seems to work in version 5.4. Is there a way to do project name substitutions with custom project templates? Is there a way to run code on the Windows machine or the target machine as part of creating a new project?
Also, custom project templates and it appears that the support for standard linux project templates from “program files\Sysprogs\VisualGDB\ProjectTemplates\Linux” has been removed. Is this correct?January 22, 2020 at 17:35 #27193
The <VisualGDB>\ProjectTemplates\Linux folder is still present in VisualGDB 5.4 and 5.5 and the underlying logic has not changed much since v5.1.
The custom project templates are still supported, although only with the classic project types (i.e. not with Arduino, Mbed or ESP-IDF). If you believe the path substitution is not working, please share the exact steps to reproduce the issue and we will advise you on the workaround.
Regarding running custom code, it is not possible to run it during project creation, however it is possible to add it as a custom shortcut (VisualGDB Project Properties -> Custom Shortcuts) that will be available via the Project menu in Visual Studio. You can create a shortcut for the initialization commands that should be run after creating the project from the template and then run it after creating the project from the template.January 22, 2020 at 17:54 #27194
Thanks for the reply.
In the “New Linux Project” wizard in 5.4, there is no longer a way to specify a template from the <VisualGDB>\ProjectTemplates\Linux folder. The old wizard had a drop down selection of the templates that applied to Application/Shared Library/Static Library… The current wizard just has “Create a new project” with the ability to select binary type, the make tool-chain and the language standard.
For custom project templates. I have a template with file names ‘$$PROJECTNAMEBASE$$.cpp’ and ‘$$PROJECTNAMEBASE$$.h’ in the template zip file. They are copied directly to the resulting project directory. Within the files I had ‘$$PROJECTNAMEBASE_CPPID$$’ text that I expected to be replaced with the new project name. The files were copied without any textual substitutions. Perhaps there is some other mechanism to indicate that these changes should be done, like in the template.xml document. I just had this in the xml document:
I did try ‘$(ProjectName).cpp’ for the FileName as well, but it didn’t help.
I’ll include my custom template file.January 22, 2020 at 17:55 #27195
Trying the template renamed as zip.
Attachments:You must be logged in to view attached files.January 23, 2020 at 06:18 #27211
Thanks for the explanation. VisualGDB 5.4+ still uses the templates under <VisualGDB>\ProjectTemplates, however instead of showing a plain list of templates in the wizard, it allows automatically picks the best template based on the project type/build subsystem choices. As a side effect, this indeed makes it impossible to add custom templates via this mechanism.
We have updated the logic that handles the .vgdbxpt files to substitute the $$PROJECTNAMEBASE$$ and $$PROJECTNAMEBASE_CPPID$$ variables. VisualGDB will also substitute those values inside the files that have the SubstituteProjectName property set to true in the template.xml file (re-create the template using the VisualGDB build below to see the new property).
Please try this build: VisualGDB-126.96.36.19957.msiJanuary 23, 2020 at 16:02 #27214
Thank you so much. This seems to work great.
I noticed this with 5.4 and it is still a problem in this 5.5.3 build. When creating a project for a Linux shared library with a custom template the target filename doesn’t get the ‘.so’ file extension, so I’ve had to add the extension to get the build to work. I see that the template.xml file has ProjectType as SharedLibrary, but there is nothing else in it about the target file name or extension. This is from the newly created template from a project that does have .so on the output file name under Project Makefile Settings and $(TargetExtension) is ‘.so’; but a project created from the custom template does not.January 25, 2020 at 01:45 #27252
You must be logged in to reply to this topic.