NuGet problems when installing X

I run dotnet 5 on MacOS:

[Code] dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.403
 Commit:    bf9d168ac2

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  11.0
 OS Platform: Darwin
 RID:         osx.11.0-x64
 Base Path:   /usr/local/share/dotnet/sdk/5.0.403/

Host (useful for support):
  Version: 5.0.12
  Commit:  7211aa01b3

.NET SDKs installed:
  5.0.403 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

And I use JetBrains Rider (latest version) as IDE.

I tried to install dotnet 6 but it does not yet work, since I have a couple of dependencies which seem not to be ready yet (including JetBrains, it has only a preview).

So I uninstalled all SDK versions of DOTNET from my MAC using the uninstall tool provided by MS and re-installed the latest .NET 5.0 SDK. I also removed all tools I had installed.

When I try to install the X tools for ServiceStack, I get a strange NUGET error for my private MyGet repo. I have no tools installed at all:

[Code] dotnet tool list --global
Package Id      Version      Commands
-------------------------------------
[Code] dotnet tool list
Package Id      Version      Commands      Manifest
---------------------------------------------------

Here is the error I get:

[Code] dotnet tool install --global x
/usr/local/share/dotnet/sdk/5.0.403/NuGet.targets(131,5): error : Failed to retrieve information about 'x' from remote source 'https://www.myget.org/F/bizbus/api/v3/flatcontainer/x/index.json'. [/var/folders/s1/vzpxz7916450_0l_hxqddq440000gn/T/3w4f4oex.g0h/restore.csproj]
/usr/local/share/dotnet/sdk/5.0.403/NuGet.targets(131,5): error :   Response status code does not indicate success: 401 (Unauthorized). [/var/folders/s1/vzpxz7916450_0l_hxqddq440000gn/T/3w4f4oex.g0h/restore.csproj]
The tool package could not be restored.
Tool 'x' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

I don’t know why the tools installer tries to access my private MyGet repository. When I use Rider it usually asks for the password of the keystore/keyring and then gets the credentials from there. But now I try to install tools from the command-line without the IDE.

Is there any work around for this or any way to convince the tools installer not to look at private MyGet repos??

Thanks for any help.

The MyGet package source is typically defined in your NuGet.confg

Just need to remove/comment out to stop it resolving packages from MyGet.

Works great, thanks!
On the Mac the file is on ~/.nuget/NuGet/NuGet.config if anybody is ever looking for it.

1 Like

@mythz
Following this documentation it looks like x new only generates .Net 6.0 projects. I could not find a parameter to tell it to create a .Net 5.0 project. I entered:

x new selfhost PermTest

and get a series of these errors:

Installing selfhost...
running dotnet restore...
  Determining projects to restore...
/usr/local/share/dotnet/sdk/5.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(141,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 6.0.  Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. [/Users/tbednarz/Projects/BizBus/Code/PermTest/PermTest/PermTest.csproj]

I tried to change the configuration of the projects within the solution to use .NET 5 as target framework. That helped a lot and eliminated dozens of errors.

However Program.cs and Configure.AppHost.cs have errors and do not look very familiar to me, looks like this is somehow different from .NetCore 3.1 and .Net 5.

Is there any quick fix for that?

The project templates are maintained as GitHub repos at https://github.com/NetCoreTemplates
When you can create a new project it’s just using the latest version published for that template - which have all been upgraded to use .NET 6 and its new hosting model.

We do have docs on creating .NET 5 projects, basically you have to find the version of the project template you want to create, then you can specify the URL of the .zip archive you want to create.

E.g. you can create a .NET 5 web template with:

$ x new https://github.com/NetCoreTemplates/web/archive/refs/tags/v27.zip ProjectName

We’re looking at adding net5 tags to all existing .NET Core templates now, if you have a different project template you want to create let me know and I’ll find the Release version’s zip url.

Out of curiosity what’s the reason for not wanting to create new .NET 6 projects?

Hi @mythz
Thanks a lot for the information. It was already a bit late yesterday so I did not lookup the GitHub repos…

I need to create a quick and dirty proof of concept (POC) project to test a few things before I implement it in my real production code. That’s why I just wanted to create a new project using the x tools. What I need is currently a simple selfhost .net 5.0 service for my POC.

Usually I develop all my current production server code on a Fedora Workstation which runs as one of my many VMWare Fusion VMs on my Mac. For the POC I wanted to create a small project directly on the Mac, since it does not require any OS specific code.

As I wrote in my previous post, dependencies and my dev environment are the main reasons. JetBrains Rider does not yet have full support for the 6.0.100 SDK. And my servers use a whole bunch of other technologies such a MongoDB, Redis, RabbitMQ, Reporting Tools and other stuff. Some of them are not yet ready for 6.0 or we did not have time to test it. Official MS release was about two weeks ago and that is too new for me to update. We usually stick with LTR’s and therefore use .NET Core 3.1 in all of our production servers. Probably in spring next year we will switch to .NET 6 (which is the new LTR) and stay with it for another two and a half years.

We focus more on stability and business functionality than on the very latest technology. As long as we get security issues and bugs fixed, we are generally fine with what something like .NETCore 3.1 provides…

Yep was just curious because .NET 6 is the modern LTS release which .NET 5 isn’t, I understand why you’d not want to migrate existing projects, but thought it strange to create new project templates with it. Rider’s stable version not having .NET6 support is a good reason, but Rider’s latest EAP has good support for it.

Also note that all our mix features have been rewritten to use .NET 6’s new hosting model, to use the old mix feature gists you’ll need to specify a different source gist, i.e:

$ MIX_SOURCE=7362ea802aef361bbdc21097b6a99e0d x mix

Anyway we’ve finished adding net5 tags to existing .NET Core Project Templates so you can create .NET 5 projects with:

$ x new https://github.com/NetCoreTemplates/<template>/archive/refs/tags/net5.zip ProjectName

I’ve also added support for creating .NET 5 project templates on our online project creator page:

https://servicestack.net/start?tag=net5

@mythz I digged around a bit on GitHub and could create my project with

x new https://github.com/NetCoreTemplates/selfhost/archive/refs/tags/v13.zip PermTest

That seems to work for me at the moment.
Cheers, T.

Yep so should:

x new https://github.com/NetCoreTemplates/selfhost/archive/refs/tags/net5.zip PermTest

As well as downloading it from: https://servicestack.net/start?tag=net5#Name=PermTest

The new project is just a POC, not production stuff. But it does not make sense to create a POC based on newer technology than the stuff in production is based on!

My services have accumulated a huge codebase since they started back in 2016 with ServiceStack 4.0 (your first ‘commercial’ release). At that time there where no templates, no X-tool etc… They are current with .NETCore 3.1 which is the last LTR.

As I wrote we will stick with LTRs but for production software we do not accept any beta software and no EAPs etc. Somewhere in Q1-2022 will be the right time to start the migration.

1 Like

Sure it’s natural to never use beta software for running production, but Rider EAP is just the IDE dev tool for authoring source code, it still uses the .NET 6 LTS SDK to build your project so no beta software will end up making it into your production builds, anyway sounds like it’s just a temporary transition, was just curious to know what the blocker to using .NET 6 for new projects was to see if it’s something we can help with, as of yet I haven’t discovered any behavioral differences between .NET 5 vs 6.