-
Notifications
You must be signed in to change notification settings - Fork 358
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
Question on dotnet uninstall #961
Comments
Hi @guardrex, Please let us know if that works for you. |
@seancpeters Ah! ..... the ONE thing I didn't try! lol .... Thanks much! I'm good, and I'll make sure the doc spells that out. |
@seancpeters Just want to mention one quick thing in passing tho: It seems awfully easy to have orphan template entries: If the folder containing the template is moved, deleted, or renamed, it orphans the template in the list without an easy way to uninstall/remove it. Apparently, one has to re-create the template folder (perhaps with just the .template.config\template.json file) in order to run the uninstall command. Perhaps the team might consider a few proposals? ....
If any of this makes sense to discuss, it might go better on a new issue, so let me know. Otherwise, feel free to close. I'm just tossing out some ideas/concerns on it. |
... and I've run into another little misunderstanding. I zipped a template into template7.zip. I was able to install it ok ... dotnet new -i c:\template7.zip ... but when try to uninstall that one with ... dotnet new -u c:\template7.zip ... it says ...
|
One more problem: After installing a template from a ZIP (template8.zip; dotnet new giraffe8 ... it fails with ... If you need any of this on new issues, let me know. Right now, I'm not sure if I'm still not making mistakes on my end of using the |
While installing templates from .zip sources works, it's not a fully supported scenario. So there's not a real uninstall story for zip-installed templates at this time. Dotnet new offers full support for installing directly from files, and from nupkg's. If you install from a nupkg, you can uninstall the templates from the nupkg by giving the nupkg name on the command line, e.g.: Warning: Running that command will uninstall all of the web templates shipped with dotnet new (so you probably don't want to run that specific command). Your suggestions for other delete scenarios are good, we've had numerous discussions about other uninstall scenarios, and may support some of them in the future. In general, finding out the issues you & other real-world users are running into is a great source for enhancement ideas. Definitely continue letting us know what issues you run into & additional functionality you'd like. We can leave this all as one issue, it's not a problem. |
Your error with the giraffe8 template is peculiar. I'm not yet certain what would have caused it. If you can provide any additional information or steps taken, it might help me figure it out. If you want to reset your installation to its initial state, which will remove all custom installed templates, you can run: |
Thanks for your help.
Ah, I see. I'll leave it out of the doc. I picked up on it from @sayedihashimi's blog post and the Wiki text. btw- This is all for the work on dotnet/docs#2139. We're adding a ref doc for the custom templates. For a walk-through/tutorial, we're planning on pointing readers to @sayedihashimi's blog post. There might be (probably will be) a formal tutorial in the Core docs later. I'll go with install/uninstall from the following:
... so I'll leave that one out as well. I won't be describing Zip-based templates, but here's how it went with my
|
Thanks for the additional info. Unfortunately, I'm still unable to reproduce the issue. Could you provide the directory structure of this template (unzipped)? For example the C# 2.0 class library template looks like this:
The error message about looking for template.json at the c:\ directory is most likely an issue with the error reporting, I think I see how that could report incorrectly. Once I can repro the main issue, the reason & fix for the incorrect error message will hopefully be obvious. |
It's just the basic "Giraffe" template. The only thing I'm changing in it is the template.json file. The directory structure of the uncompressed version is ...
I acquired it by grabbing the ZIP of the whole https://github.com/dustinmoris/Giraffe repo and then pulling out the template/content folder contents into my own template folder, which is template9 for my latest test. and the template.json is ... {
"identity": "Giraffe9.Template",
"author": "guardrex",
"classifications": [ "Web", "Giraffe", "blah" ],
"name": "Giraffe Web App9",
"tags": {
"language": "F#"
},
"shortName": "giraffe9",
"sourceName": "_AppName"
} |
@seancpeters I had to delete my last message, because I was still in the process of wrapping my brain around it: It turns out that one installs from a nupkg on disk (locally) (never from a nuspec) but then uninstalls by just providing the package name as you said earlier. So if the user installs with ... dotnet new -i C:\Users\<USER>\GarciaSoftware.ConsoleTemplate.CSharp.1.0.0.nupkg they uninstall with ... dotnet new -u GarciaSoftware.ConsoleTemplate.CSharp.1.0.0 Going back to an earlier post, I think it would be far simpler if uninstall was merely based on giving the dotnet new -u garciaconsole ... and let the ✨ .NET magic ✨ figure out where/what to uninstall, even if it only meant delisting the template (i.e., when the template itself is no longer on disk or a template at nuget.org doesn't exist/can't be found). I think that I have what I need to get the 1st draft of this topic out, which relies heavily on the Wiki and @sayedihashimi's blog post to cover the deeper/finer points. Is it ok if I ping you on the PR to take a 👀 look at it? |
@guardrex - definitely feel free to ping me on any PR's for this repo :) |
@seancpeters Excellent, thanks. I'm giving it a final read before I add it to our 2.0 CLI commands update topics on our |
@guardrex @seancpeters should this be closed? It's been a while since the last update |
@mlorbetske Yeah ... I only reopened on the possibility that the uninstall might get a feature whereby one could specify the short name and have the template uninstalled, regardless of whether or not the assets (the template folder or nupkg) was on disk. |
For those who have some of those "orphan" templates after experimenting, you can find how to remove them by launching the command:
that will list your installed templates. You can see the needed keys to uninstall them. |
I think I have a misunderstanding on how
-u|-uninstall
works (or perhaps there's a list refresh that I'm missing for an uninstalled template).For testing purposes I created a few file system test templates, such as this one for
Giraffe4.Template
/giraffe4
...Install works fine ...
dotnet new -i c:\template4
However, uninstall doesn't want to remove the template. I've tried the following two commands ...
... but the template persists in the list ...
dotnet --info
:The text was updated successfully, but these errors were encountered: