BorisWilhelms / create-dotnet-devcert

A simple script that creates and trusts a self-signed development certificate for dotnet on Linux distributions.
https://blog.wille-zone.de/post/aspnetcore-devcert-for-ubuntu
MIT License
335 stars 74 forks source link

Requires dotnet 5. #3

Closed megafluffles closed 1 year ago

megafluffles commented 3 years ago

Hi, I think this just needs to be added to the prerequisites. Version 3.1 of dotnet dev-certs https doesn't support the --import option as best I can tell.

sarvasana commented 3 years ago

Correct, I ran into that as well. If someone does not know that, they are puzzled. Better to mention it.

hugofdsantos commented 3 years ago

Stuck on this as well. Maybe is there a workaround for dotnet 3.1?

sarvasana commented 3 years ago

Stuck on this as well. Maybe is there a workaround for dotnet 3.1?

Install net5, use net31.

hugofdsantos commented 3 years ago

Well, I felt like an idiot now 😆. Thank you.

sarvasana commented 3 years ago

Wow, I just installed a new machine (manjaro) and am having issues with running dotnet dev-certs https.

Got net5 installed. Could not find the dotnet tool. Ran dotnet tool install --global dotnet-dev-certs Now dotnet dev-certs https does not support the --import argument.

What is going on?

EDIT: Ok, so apparently dotnet-dev-certs comes with net5, so there is no need to install it from nuget. I forgot about that. Installing from nuget will give you a really old version from 2018. Do not do that!

Either I am missing some environment variable or path on my PATH variable or the net5 packages in the arch repositories are broken. When I install those, dotnet-dev-certs cannot be found.

When I install dotnet using ./dotnet-install.sh -c Current the dotnet-dev-certs global tool can be found. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script

sarvasana commented 3 years ago

I ran into more problems when using the dotnet-install.sh script. Problems I had were:

This was most likely caused because dotnet got installed at ~/.dotnet.

The solution that does work is: curl -sSL https://dot.net/v1/dotnet-install.sh | sudo bash /dev/stdin -c LTS --install-dir /usr/share/dotnet curl -sSL https://dot.net/v1/dotnet-install.sh | sudo bash /dev/stdin -c Current --install-dir /usr/share/dotnet sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet

Related regression: 5.0.4 is missing DotnetTools https://github.com/dotnet/source-build/issues/2109

abrahamlaria commented 3 years ago

Hello, I'm using Ubuntu and I installed the certificate following the pre requisites. Still when trying to run an asp.net core 5.0 application the browser says it is not secure. In Rider it doesn't even open the browser and it stop the program. In VS Code it starts listening on https://localhost:5001 but it doesn't open any browser as well. Entering the URL directly on the browser shows the not secure warning. Am I missing something? Thanks!

sarvasana commented 3 years ago

In the browser you can simply trust the certificate by using the rendered warning page.

The other issues are probably caused by incorrect launchsettings. I would check those.

abrahamlaria commented 3 years ago

Thanks, I got it to work :)

BorisWilhelms commented 3 years ago

Good point. Yes, dotnet dev-certs https --import needs .NET 5. I will update the README and add this to the prerequisites.

While it is technically possible to add the cert to .NET Core 3.1 SDK, I am not a bash specialist and don't know how to check and add this.

If someone is willing to this contact me and we can discuss this.

BorisWilhelms commented 1 year ago

I guess we can close this. .NET 3.1 and .NET 5 are EOL and out of support.