Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
768 views
in Technique[技术] by (71.8m points)

razor pages - An error was encountered while initializing templates Visual Studio 2019

I get this error when I try to add a Razor Page:

image

I've tried cleaning the project and even repairing Visual Studio via the installer to no avail.

Opening the indicated log, I can see at the end:

<entry>
    <record>3545</record>
    <time>2021/01/26 11:36:35.647</time>
    <type>Error</type>
    <source>Template Bootstrapper</source>
    <description>Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path &apos;&apos;, line 1, position 25.&#x000D;&#x000A;   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)&#x000D;&#x000A;   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)&#x000D;&#x000A;   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.EnsureInstallDescriptorsLoaded()&#x000D;&#x000A;   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.WriteInstallDescriptorCache()&#x000D;&#x000A;   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save(TemplateCache cacheToSave)&#x000D;&#x000A;   at Microsoft.TemplateEngine.Edge.Settings.SettingsLoader.Save()&#x000D;&#x000A;   at Microsoft.TemplateEngine.Edge.Settings.ComponentManager.Save()&#x000D;&#x000A;   at Microsoft.TemplateEngine.Edge.Settings.ComponentManager.RegisterMany(IEnumerable`1 typeList)&#x000D;&#x000A;   at Microsoft.TemplateEngine.IDE.Bootstrapper.Register(Assembly assembly)&#x000D;&#x000A;   at Microsoft.VisualStudio.TemplateEngine.Shared.Host.TemplateEngineBootstrapperFactory.TemplateEngineBoostrapper.Register(Assembly assembly)&#x000D;&#x000A;   at Microsoft.VisualStudio.TemplateEngine.TemplateEngineHostManager.InitializeEngine()</description>
  </entry>
question from:https://stackoverflow.com/questions/65900657/an-error-was-encountered-while-initializing-templates-visual-studio-2019

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try updating Visual Studio to the latest version. That solve our issue when we encountered the same problem


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...