IntentArchitect / Support

A repository dedicated to handling issues and support queries
3 stars 0 forks source link

Application template - generate projects based on installation modules #23

Closed Laura-BSC closed 1 year ago

Laura-BSC commented 1 year ago

Ask a question

We have an application template used to create projects using our default project structure and to install the components we typically use, which can be toggled based on specific project requirements.

Our projects typically use Azure Functions and Service Bus and we have modules to facilitate the creation of these. Our application template creates projects for the various templates to be installed (for example, an Azure Functions Project is created and the templates related to functions are placed there), for example:

image

The issue is that sometimes our projects don't need all our default modules installed. We can toggle the modules to be installed with no issue (the module is not installed), however, the empty project is still created

image

Is there a way to configure the application template so that it only creates the project if a specific module is installed?

Here's a snippet from our application template:

image

dandrejvv commented 1 year ago

Hi @Laura-BSC.

This is indeed possible through module metadata installation which is covered in this article which covers the metadata installation from both Application Templates and modules.

At a high level, you want to remove the "optional" metadata from the application template and move it into the modules which are optional.

Happy to provide any further assistance as needed.

Laura-BSC commented 1 year ago

Thanks @dandrejvv, that got me quite far, however, my template is fairly complex in terms of the number of optional modules and thus the number of projects that are generated based on what is selected. Complicating things further is that some modules need to install on the same project but can be installed independently.

When I install most of the modules, it generates the Visual Studio designer more or less as I would expect it (there are a few templates that are not placed in the correct place based on their role (and default location in some cases). However, there are 3 modules that if I choose to install them, cause the output to give odd results (see the screenshots below for examples):

Installed modules: image

Visual Studio designer with a few issues: image

Installing our AutoMapper module in addition: image

dandrejvv commented 1 year ago

Hi @Laura-BSC . I notice a huge difference between the first and second screenshot. Maybe we should talk over our support channel to get to the bottom of this issue.

JonathanLydall commented 1 year ago

Hi @Laura-BSC,

Thanks for taking the time earlier for us to go through this together to ensure this was working for you.

Just to re-cap for the benefit of anyone else coming across this thread, the scenario was essentially as follows:

After using the application template and selecting the optional component, then in the Visual Studio designer Template Output B was not being assigned to Project A even though it had the Role A role inside of it.

The fix was to add a <dependency /> to Module B's .imod file for Module A and ensure you are running at least Intent Architect 4.0.1 which now ensures modules are installed in order of dependency which would result in Module A's installation metadata being added to the Visual Studio designer so that when Module B was installed afterwards it would find Role A and put its Template Output B into the correct place.