I'm trying to run dotnet new install .\ and I get the following error:
Error: Failed to retrieve template packages from provider 'Global Settings'.
Details: Error reading JObject from JsonReader. Path '', line 0, position 0.
Error reading JObject from JsonReader. Path '', line 0, position 0.
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Microsoft.TemplateEngine.JExtensions.ReadObject(IPhysicalFileSystem fileSystem, String path)
at Microsoft.TemplateEngine.Edge.BuiltInManagedProvider.GlobalSettings.GetInstalledTemplatePackagesAsync(CancellationToken cancellationToken)
at Microsoft.TemplateEngine.Edge.BuiltInManagedProvider.GlobalSettingsTemplatePackageProvider.InstallAsync(IEnumerable`1 installRequests, CancellationToken cancellationToken)
at Microsoft.TemplateEngine.Cli.TemplatePackageCoordinator.EnterInstallFlowAsync(InstallCommandArgs args, CancellationToken cancellationToken)
at Microsoft.TemplateEngine.Cli.Commands.InstallCommand.ExecuteAsync(InstallCommandArgs args, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, InvocationContext context)
at Microsoft.TemplateEngine.Cli.Commands.BaseCommand`1.InvokeAsync(InvocationContext context)
I have even try to run dotnet new list it returns the VS2022 packages but not the ones that I had previously installed before getting the above error. Also when I get dotnet new list I'm again getting the below before the list of templates
Error: Failed to retrieve template packages from provider 'Global Settings'.
Details: Error reading JObject from JsonReader. Path '', line 0, position 0.
I tried to install .NET 7 SDK again and still gives the same errors
For anyone out there spending his hours trying to find what is the issue causing this, I found the solution to this. Based on this issue
<user folder>\.templateengine\packages.json The package.json file was empty. I deleted it and then ran dotnet new list and issue was resolved
It is typically caused by an issue with the configuration of the dotnet new command, specifically with the global settings that are used to retrieve template packages from the provider.
You can try those few things to resolve this issue
Delete the global.json file. This file contains the global settings for the dotnet new command, and if it's corrupt or missing, it can cause the error you're seeing. This file is typically located in the root directory of your application
Clear the NuGet package cache. The cache may have become corrupted and is preventing dotnet new from working properly. dotnet nuget locals all --clear
Related
When trying to build my Xamarin project in Visual Studio 2022 I am receiving this error:
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\120\lp\100\jl\bin\classes.jar : com/google/android/gms/measurement/internal/zzai.class
My build log shows this:
Error in obj\Debug\120\lp\100\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class:
Type com.google.android.gms.measurement.internal.zzai is defined multiple times: obj\Debug\120\lp\100\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class, obj\Debug\120\lp\101\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class
I have used 7zip to extract the specified zzai.class file however I don't know what to do from here. Trying to edit the file in notepad++ just shows noninterpretable code.
I fixed the issue by uninstalling unnecessary NuGet packages for Xamarin.GooglePlayServices.Measurement, only keeping the dependent packages required for Xamarin.Firebase.Analytics:
Xamarin.GooglePlayServices.Measurement
Xamarin.GooglePlayServices.Measurement.Api
Xamarin.GooglePlayServices.Measurement.Sdk
Really struggling with an issue publishing a Blazor WASM project that is using .NET 6.
Previously, it was on .NET 5, and there were no issues with building / publishing the app.
I've updated it to .NET 6, by essentially updating the nuget references for:
Microsoft.AspNetCore.Components.WebAssembly (to 6.0.0-rc.2.21480.10)
Microsoft.AspNetCore.Components.WebAssembly.DevServer (to 6.0.0-rc.2.21480.10)
We've updated to .NET 6 due to a requirement on DynamicComponent
Running locally during development is fine.
During our build pipeline, I am executing the following to publish the app:
dotnet publish .\Web\Web.Connect --configuration debug --output output
The output that I am getting is:
Web.Connect -> C:\git\core\Web\Web.Connect\bin\debug\net6.0\Web.Connect.dll
Web.Connect (Blazor output) -> C:\git\core\Web\Web.Connect\bin\debug\net6.0\wwwroot
Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : System.ArgumentException: An item with the same key has already been added. Key: C:\git\core\Web\Web.Connect\obj\debug\net6.0\build-gz\bxkpRzBw.gz [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at Microsoft.NET.Sdk.BlazorWebAssembly.ComputeBlazorPublishAssets.GroupExistingStaticWebAssets(Dictionary`2 assemblyAssets, Dictionary`2 nativeAssets, Dictionary`2 satelliteAssemblyAssets, Dictionary`2 symbolAssets, Dictionary`2 compressedRepresentations) [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at Microsoft.NET.Sdk.BlazorWebAssembly.ComputeBlazorPublishAssets.Execute() [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
Ok - so some asset is trying to be published multiple times in ComputeBlazorPublishAssets?
Found information indicating that adding <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> to the *.csproj might help here, but it has made no difference.
I have ensured that the wasm-tools have been installed via dotnet workload install wasm-tools.
Running a "Publish" via VS 2022 also gives the same error.
I am at a loss as to how I can debug this, or figure out what is getting generated twice, or how to fix this issue.
Thanks.
Ok,
After a significant amount of investigation looking at the binlog files, I have managed to track this down to the fact that my referenced library (which is a netstandard 2.0 project shared with other projects in the solution) was also outputting an app.config file (possibly due to an earlier time when we targeted both netstandard2.0 and net472).
Looking at the MSBuild bin logs:
So, there were two compressed files with the same name - one was referencing the actual *.dll, but the other was referencing *.dll.config
I deleted the app.config (it wasn't really needed and was probably there due to some historic reason) and it's now publishing as expected.
Due to some custom reasons, we have some custom built-in features in the XF (like the XAML-based toolbar button and changing private-internal to the public classes, plus virtualizing some methods). As the result, we are dependent on the custom version of the XF NuGet package.
It worked (almost always) perfectly until the version XF5.0. I have a dedicated virtual machine with Windows and preinstalled VS for those purposes.
When I'm trying to build XF from sources using the next command
.\build.ps1 -Target NugetPack -ScriptArgs '--packageVersion="5.0.0.2013"'
I get the error:
Successfully created package 'L:\src_github\xf_patch_release-5.0.0-sr3.1\artifacts\Xamarin.Forms.Maps.WPF.5.0.0.2013.nupkg'.
NuGet Version: 5.9.1.11
Attempting to build package from 'Xamarin.Forms.temp.nuspec'.
Object reference is not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.Packaging.PackageBuilder.<>c.<ValidateReferenceAssemblies>b__173_1(NuGet.Frameworks1204671.NuGetFramework groupFramework)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at NuGet.Packaging.PackageBuilder.ValidateReferenceAssemblies(IEnumerable`1 files, IEnumerable`1 packageAssemblyReferences)
at NuGet.Packaging.PackageBuilder.Save(Stream stream)
at NuGet.Commands.PackCommandRunner.BuildPackage(PackageBuilder builder, String outputPath, Boolean symbolsPackage)
at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
An error occurred when executing task '_NuGetPack'.
Error: One or more errors occurred. (NuGet: Process returned an error (exit code 1).)
NuGet: Process returned an error (exit code 1).
I've tried to use different methods to get rid of this non-understandable issue, but nothing happened. I've tried to use the latest actual release-5.0.0-sr3.1 tag and the latest version of the branch 5.0.0
I've tried to change some settings in the build.cake file, to unload some projects from the solution (like UWP-related ones, which usually caused a lot of errors). I've tried to build the solution on my working computer (and environment) - I got the same result.
Then I switched to building the solution in the VS directly and started getting issues like:
Before calling the main task to build: .\build.ps1 -Target NugetPack... I always call the .\build.ps1 -Target provision to ensure that I haven't missed some required tools on each Windows OS.
Is there something that I have missed?
I've found out that I'm using a different version of the NuGet package manager, which I had to install globally on my OS. The right version can be found in the XF's Pipelines (https://dev.azure.com/xamarin/public/_build, see the Windows-related builds).
After I've changed the global version to 5.6.0, the build script started generating the *.nupkg file for the Xamarin.Forms project itself correctly.
...
I'm trying to publish my first test function to Azure functions. When I publish I get the error:
Publish has encountered an error.
Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
A diagnostic log has been written to the following location:
"C:\Users\me\AppData\Local\Temp\tmp2C29.tmp"
The contest of that file say it was an unknown error, check the output log.
When I look at my output window I see this:
2>Unhandled Exception: System.IO.DirectoryNotFoundException: The path `D:\Dev\FunctionsTest-master\custom-binding\obj\Debug\netstandard2.0\PubTmp\Out\bin` does not exist. Unable to generate Azure Functions extensions metadata file.
2> at ExtensionsMetadataGenerator.ExtensionsMetadataGenerator.Generate(String sourcePath, String outputPath, Action`1 logger) in D:\src\gh.fabiocav\azure-functions-host\tools\ExtensionsMetadataGenerator\src\ExtensionsMetadataGenerator.Console\ExtensionsMetadataGenerator.cs:line 25
2> at ExtensionsMetadataGenerator.Console.Program.Main(String[] args) in D:\src\gh.fabiocav\azure-functions-host\tools\ExtensionsMetadataGenerator\src\ExtensionsMetadataGenerator.Console\Program.cs:line 28
2>Metadata generation failed.
I looked and the ...\PubTmp\Out\bin folder is not where it's being compiled. The actual folder is \PubTmp\Out\ (one folder higher).
I don't see any way of changing the folder location, I tried under properties of the function - build, but that path is the top level; not the final path.
I also don't see any way of selecting where the publish is looking for the compiled functions to publish.
How do I get these locations to be the same for the publish to work?
It appears that this was a bug in Visual Studio 2019. Patching to the current version took care of it.
The program is executing properly without any error in Debug configuration But in Release configuration it throws an error.
The "ParseILMergeInfoTask" task failed unexpectedly.
System.Exception: File 'SharedAssemblyILMergeInfoFilePath' passed to argument 'x86\ret\SharedAssemblyILMergeInfo.csv' does not exist.
at Microsoft.Build.ILTasks.ParseILMergeInfoTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
I can't run any program in Release configuration. It throws the same error.
Update
I think I found the problem but I don't know to resolve it. Previously I had an error Unable to load package 'Microsoft.Net.Native.SharedLibrary-x64'. To resolve it I follow it this answer. So I installed Microsoft.Net.Native.SharedLibrary-x64.1.6.1, Microsoft.Net.Native.SharedLibrary-x86.1.6.1 and Microsoft.Net.Native.SharedLibrary-arm.1.6.1 manually. Now If I open Microsoft.Net.Native.SharedLibrary-x64 package folder I can't find build and tools folder within it.
It is a problem due to the Internet connection.
Just delete the package
C:\Users\ponvi\.nuget\packages\microsoft.net.native.sharedlibrary-x64
Download the package using Mobile Data.
Another answer by rubStackOverflow
Really strange issue, in my case, I had to change my default network
DNS(network card) from 8.8.8.8 to 208.67.222.222.