Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template updates #31

Merged
merged 1 commit into from
Oct 3, 2023
Merged

Template updates #31

merged 1 commit into from
Oct 3, 2023

Conversation

DamianEdwards
Copy link
Member

@DamianEdwards DamianEdwards commented Oct 2, 2023

  • Adds missing .sln files to templates so that they're created when creating projects from the CLI
  • Update the starter app template to be type "solution" (matching the empty template)
  • Add post-create task to restore packages when created from the CLI

Fixes #21

@phenning despite these changes, when using the starter app template in VS, it's still prompting for a project name and creating an extra directory under the solution directory. Is there something else that needs to be done to get it to work like the empty template? Both seem to be working as intended from the CLI after these changes.
This was indeed template metadata caching causing the issue.

@phenning
Copy link
Contributor

phenning commented Oct 3, 2023

@phenning despite these changes, when using the starter app template in VS, it's still prompting for a project name and creating an extra directory under the solution directory. Is there something else that needs to be done to get it to work like the empty template? Both seem to be working as intended from the CLI after these changes.

It looks like this should be working. One thing to note that if you were applying these changes to the template.json locally, (dotnet new install) you may be running into cache issues.

Try:

dotnet new uninstall [path]
launch VS/NPD.
Close VS/NPD
dotnet new install path
Launch VS/NPD.

cache issues are only a problem when editing template metadata in place, you can generally get away with updating content without the uninstall/launch/install loop

@phenning
Copy link
Contributor

phenning commented Oct 3, 2023

Can you confirm that Web API -> Enlist in Aspire Orchestration still works after this? I'm not sure if the sln file is going to be compatible with that flow. We may need to add some logic to have the template not output the SLN if it doesn't work.

@phenning
Copy link
Contributor

phenning commented Oct 3, 2023

Also double check the Web API , create, then context menu add orchestration

@DamianEdwards
Copy link
Member Author

DamianEdwards commented Oct 3, 2023

@phenning

File -> New -> Web API -> Enlist in Aspire Orchestration, worked fine.

File -> New -> Web API -> Add Aspire Orchestration, showed the following dialog, but that's maybe because after I created the initial project I never saved the solution first?

image

EDIT: Nope, it happens whether I save the solution/project first or not.

@phenning
Copy link
Contributor

phenning commented Oct 3, 2023

@phenning

File -> New -> Web API -> Enlist in Aspire Orchestration, worked fine.

File -> New -> Web API -> Add Aspire Orchestration, showed the following dialog, but that's maybe because after I created the initial project I never saved the solution first?

image EDIT: Nope, it happens whether I save the solution/project first or not.

Did you update the solution name as I mentioned above? If not, that is what is likely to be causing this issue.

@DamianEdwards
Copy link
Member Author

OK that fixed it:

"sources": [
    {
      "modifiers": [
        {
          "condition": "(hostIdentifier == \"vs\")",
          "exclude": [
            "*.sln"
          ]
        }
      ]
    }
  ],
...
"primaryOutputs": [
    {
      "path": "AspireApplication1.sln",
      "condition": "(hostIdentifier != \"vs\")"
    },

@phenning
Copy link
Contributor

phenning commented Oct 3, 2023

Good fix, best to just not write it at all for VS, unless we are doing solution folders or other customization.

@DamianEdwards
Copy link
Member Author

@phenning please approve if you're good with this change now

@DamianEdwards
Copy link
Member Author

I'm not sure what happened to this branch as it seems to have a bunch of other stuff in it now. I'm going to fix it all and resubmit.

- Adds missing .sln files to templates so that they're created when creating projects from the CLI
- Update the starter app template to be type "solution" (matching the empty template)
- Add post-create task to restore packages when created from the CLI

Fixes #21
@DamianEdwards DamianEdwards force-pushed the damianedwards/templates-sln-file branch from ddaf9bc to 3e515ad Compare October 3, 2023 18:45
@DamianEdwards DamianEdwards enabled auto-merge (squash) October 3, 2023 18:55
@DamianEdwards DamianEdwards merged commit bda083c into main Oct 3, 2023
4 checks passed
@DamianEdwards DamianEdwards deleted the damianedwards/templates-sln-file branch October 3, 2023 19:08
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aspire templates are missing .sln file when created from dotnet CLI
3 participants