Sysprogs forums › Forums › VisualGDB › Project items are lost during VisualGDB project template export
- This topic has 1 reply, 2 voices, and was last updated 6 years, 2 months ago by support.
-
AuthorPosts
-
September 20, 2018 at 14:38 #22024regus_pregusParticipant
Environment: VisualGDB 5.4 (preview 4, build 2394) with VS Community Edition 2017 (15.8.2)
Target: STM32F746NG (on STM32F746G-DISCOVERY board)
Problem summary: project items (links to source files) that were moved within the project tree to another filter (Solution Explorer branch) are lost during VisualGDB project template export and subsequent import as a new project.
Steps to reproduce:
- Run VS with VisualGDB installed
- If any solution is automatically loaded during startup, close it (File->Close Solution)
- Create new project and solution (File->New->Project)
- New Project page: Select Installed->VisualGDB->Embedded Project Wizard, Name = Test1, Create directory for solution = CHECK, Solution name = Test (or any other unique name)
- Project type page: Create a new project with = MSBuild, Embedded binary (.elf) = check, Additional output binaries: bin = check, leave all other settings default
- Device selection page: STM32F746NG, leave all other settings default, press Next
- Sample selection page: STM32 CubeMX Samples tab, select LTDC_PicturesFromSDCard sample project, leave all other settings default
- Debug method page: Debug using = OpenOCD, JTAG/SWD programmer = ST-Link v2.1, leave all other settings default, press Finish
- Build the project (Build->Build solution) – builds without errors
- Export the project as a VisualGDB project template (first we will create a working template)
- Select File -> Export VisualGDB Project Template menu item
- In Export Project Template dialog select Test1 item, Template file to create = C:\TestB.vgdbxpt (or any other valid file path)
- Press OK
- Add new project from template (File->Add->New Project)
- New Project page: Select Installed->VisualGDB->Embedded Project Wizard, Name = Test2 (or any other unique name)
- Project type page: Create a project from a custom template = CHECK, Template file = C:\TestA.vgdbxpt, press Next
- Device selection page: leave all settings default, press Next
- Debug method page: leave all settings default, press Finish
- Build the project (Build->Build solution) – builds without errors, as expected
- Export the project as a VisualGDB project template (now we will create a non-working template)
- Create a small modification of the original project: Open Test1 -> Source Files -> Shared resources branch in Solution Explorer, select all the files in that branch and drag them into Test1 -> Source Files -> Device-specific files branch (note that original Test1 project still builds without errors if you do a full or partial rebuild at this point, so this modification in itself is not invalid)
- Select File -> Export VisualGDB Project Template menu item
- In Export Project Template dialog select Test1 item, Template file to create = C:\TestB.vgdbxpt (or any other valid file path)
- Press OK
- Add new project from template (File->Add->New Project)
- New Project page: Select Installed->VisualGDB->Embedded Project Wizard, Name = Test3 (or any other unique name)
- Project type page: Create a project from a custom template = CHECK, Template file = C:\TestB.vgdbxpt, press Next
- Device selection page: leave all settings default, press Next
- Debug method page: leave all settings default, press Finish
- Inspect Test3 -> Source files -> Device-specific files branch in Solution Explorer – the files that we have dragged in original project did not propagate to the Test3 project through the template.
- Build the project (Build->Build solution). Multiple linker errors will result due to the fact that the source files as described above are now missing and did not compile.
Interestingly enough, I experimented with other ways to modify the project and this is it what I could observe:
- If you rename Shared resources filter in Test1 -> Source Files branch in the Solution Explorer instead of dragging the files to Device-specific files filter before creating a template, then the files in question will not disappear when a new project is created from such template.
- If you create a new filter (folder) in the Solution Explorer under Test1 -> Source Files branch and drag the files there from the Shared resources filter before creating a template, then the files in question will not disappear when a new project is created from such template.
- If you drag the files from Shared resources filter Test1 -> Source Files branch in the Solution Explorer into Src filter under the same Test1 -> Source Files branch before creating a template, then the files in question will not disappear when a new project is created from such template.
- So they only disappear when you drag files into Device-specific files filter before creating a template.
September 22, 2018 at 04:46 #22045supportKeymasterHi,
Sorry, this is by design. The “Device-specific files” filter is reserved for the files from the BSP that are automatically managed by VisualGDB. E.g. when you change the MCU type or add/remove frameworks, VisualGDB may replace the entire contents of that filter with the files specified by the current BSP version. The template logic also follows this convention – it stores the device ID and settings and re-creates the contents of device-specific files based on the BSP definition. I.e. if you use the same template with a later version of the BSP, it will still use the correct list of files from the new BSP.
Unfortunately it is somewhat confusing as the “Device-specific files” filter is not shown differently from other filters due to the limitations of the VC++ project subsystem. Long-term we are planning to switch our embedded projects to the Advanced CMake Project Subsystem, so VisualGDB will have fine-grain control over the contents of the Solution Explorer and will be able to clearly show which files are automatically managed by VisualGDB.
-
AuthorPosts
- You must be logged in to reply to this topic.