Dotnet new fails: Object reference not set to an instance of an object
See original GitHub issueSteps to reproduce
dotnet new console and dotnet new
Expected behavior
Creates a new console app / lists help for dotnet new
Actual Behavior
Getting ready...
Object reference not set to an instance of an object.
at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save(TemplateCache cacheToSave)
at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save()
at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests, IList`1 nuGetSources, Boolean debugAllowDevInstall)
at Microsoft.TemplateEngine.Cli.Installer.InstallPackages(IEnumerable`1 installationRequests)
at Microsoft.DotNet.Tools.New.NewCommandShim.FirstRun(IEngineEnvironmentSettings environmentSettings, IInstaller installer)
at Microsoft.TemplateEngine.Cli.New3Command.ConfigureEnvironment()
at Microsoft.TemplateEngine.Cli.New3Command.Initialize()
at Microsoft.TemplateEngine.Cli.New3Command.ExecuteAsync()
at Microsoft.TemplateEngine.Cli.CommandParsing.NewCommandInputCli.<>c__DisplayClass19_0.<<OnExecute>b__0>d.MoveNext()
Environment Data
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: opensuse-tumbleweed
OS Version: 20191204
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 157910edee
.NET Core SDKs installed:
3.1.100 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Tried Fixes in Dotnet new fails: Object reference not set to an instance of an object #657
ie.
dotnet new --debug:reinit
rm -rf ~/.templateengine
Did not have this problem with dotnet sdk 2.0.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7
Top Results From Across the Web
How to solve error object reference not set to an instance of ...
I work on csharp i get error object reference not set to an instance of an object code give me error var Data...
Read more >c# - .net 6 - Object reference not set to an instance of an ...
.net 6 - Object reference not set to an instance of an object - after object instantiation, data is valid ; new PaymentList();...
Read more >Fix: "Object Reference Not Set to an Instance of ...
The error message "Object reference not set to an instance of an object" means that perhaps you're referring to an object that doesn't...
Read more >Get to the Bottom of C# Object Reference Not Set to an ...
So, this error description says that an object that is being called to get or set its value has no reference. This means...
Read more >Fix “Object Reference Not Set to an Instance of an ... - YouTube
Fix “ Object Reference Not Set to an Instance of an Object ” in Microsoft Visual Studio In this post, we will show...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I fixed it by wiping the “/usr/share/dotnet/templates” and “~/.templateengine” folders. Then reinstalling dotnet core 3.1 and then running dotnet new --debug:reinit.
Everything works fine now.
Tenía el mismo problema con net5.0. Borré “/usr/share/dotnet/templates” como dice JorgeGomez y listo. Pero ahora me sale el siguiente error: The framework ‘Microsoft.AspNetCore.App’, version ‘5.0.0’ was not found.