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

Unable to uninstall template #4156

Closed
sayedihashimi opened this issue Nov 29, 2021 · 4 comments · Fixed by #4613
Closed

Unable to uninstall template #4156

sayedihashimi opened this issue Nov 29, 2021 · 4 comments · Fixed by #4613
Assignees
Labels
triaged The issue was evaluated by the triage team, placed on correct area, next action defined.
Milestone

Comments

@sayedihashimi
Copy link
Member

I'm trying to uninstall a template, but keep getting an error that the folder isn't found. The folder does exist, but there must be some issue with the template engine that doesn't like it for some reason.

Here is what I'm doing.

  1. Run dotnet new -u to get uninstall command
  2. Run uninstall command

Expected: template to be uninstalled
Actual:

C:\data\mycode> dotnet new --uninstall sayedha.templates
The template package 'C:\data\mycode\sayedha.templates' is not found.
To list installed template packages use:
   dotnet new --uninstall

What can I do to diagnose this? I tried dotnet new --debug:reinit but that seems to no longer work. Is there some built-in command that can be used to reset dotnet new to the install state? That's super handy for template developers.

Here is a gif
templates-uninstall
.

@vlada-shubina
Copy link
Member

vlada-shubina commented Nov 30, 2021

@sayedihashimi could you please try to recall the command you installed the template with? (and path you used - it might matter)

I see that uninstall command is not correct in -u output - it should contain absolute path to folder. Subsequent issues may be caused by that.

I assume that you installed nupkg and not the folder. But due to folder with same name exists in this working folder, it tries to uninstall the folder package, not the nupkg, and fails due to folder is not installed.

To prove assumption, just try to execute the uninstall command from different folder.

It's a bug anyway, and I'll fix it, but it's very special case.

@vlada-shubina vlada-shubina added the need-customer-info Requires feedback from author label Nov 30, 2021
@sayedihashimi
Copy link
Member Author

@vlada-shubina you were correct, I changed directories and the uninstall command worked. Here is the output.

C:\temp> dotnet new --uninstall sayedha.templates
Success: sayedha.templates::1.0.5 was uninstalled.

What a strange bug, definitely would never have figured that out on my own. Do you think we'll be able to fix this or is this something that template authors will need to learn?

@vlada-shubina
Copy link
Member

yes, it is possible to fix it; I will keep it open.

@vlada-shubina vlada-shubina added triaged The issue was evaluated by the triage team, placed on correct area, next action defined. and removed need-customer-info Requires feedback from author labels Nov 30, 2021
@vlada-shubina vlada-shubina added this to the Backlog milestone Nov 30, 2021
@sayedihashimi
Copy link
Member Author

Sounds good thanks. I'll add some note in about this in my doc.

@JanKrivanek JanKrivanek modified the milestones: Backlog, April 2022 Apr 4, 2022
@JanKrivanek JanKrivanek self-assigned this Apr 4, 2022
JanKrivanek added a commit to JanKrivanek/templating that referenced this issue Apr 19, 2022
JanKrivanek added a commit that referenced this issue Apr 27, 2022
* #4156 Honor explicitly requested package identifier during uninstall

* #4613 Improve logic (path expansion only for local packages), add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged The issue was evaluated by the triage team, placed on correct area, next action defined.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants