"dotnet restore" fails for Azure DocumentDB emulator sample project - visual-studio

I want to just try out the same project to communicate with a local instance of the DocumentDB emulator released just a few weeks back. I already have dotnet core installed and the dotnet core CLI.
Download the emulator from https://learn.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator
Install the emulator (takes no more than a few seconds)
A browser is fired up for the emulator, it is now working.
Click on the link to download sample dotnet core project
Extract the files, open in VS2015 and build. This fails.
I thought my tooling in VS2015 might be outdated so I installed the latest tooling from https://www.microsoft.com/net/core#windowsvs2015 named ".NET Core 1.0.1 tools Preview 2" but to no avail. Still fails.
Running dotnet restore from command line gives the same error as VS2015, which is:
C:\repos\quickstart-dotnetcore [(unknown)]> dotnet --version
1.0.0-preview2-003131
C:\repos\quickstart-dotnetcore [(unknown)]> dotnet restore
log : Restoring packages for C:\repos\quickstart-dotnetcore\project.json...
error: Unable to resolve 'Microsoft.Azure.Documents.Client (>= 0.1.0)' for '.NETCoreApp,Version=v1.0'.
log : Restoring packages for tool 'BundlerMinifier.Core' in C:\repos\quickstart-dotnetcore\project.json...
log : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\repos\quickstart-dotnetcore\project.json...
log : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\repos\quickstart-dotnetcore\project.json...
log : Lock file has not changed. Skipping lock file write. Path: C:\repos\quickstart-dotnetcore\project.lock.json
log : C:\repos\quickstart-dotnetcore\project.json
log : Restore failed in 1948ms.
Errors in C:\repos\quickstart-dotnetcore\project.json
Unable to resolve 'Microsoft.Azure.Documents.Client (>= 0.1.0)' for '.NETCoreApp,Version=v1.0'.
Googling on it gives results with NuGet configuration suggestions, but I'm not sure where this Microsoft.Azure.Documents.Client is actually located. On what package source? Currently i'm using this package source if I look inside VS2015: https://api.nuget.org/v3/index.json

In project.json, please update
"Microsoft.Azure.Documents.Client" : "0.1.0"
to
"Microsoft.Azure.DocumentDB.Core": "*"
The sample has an incorrect package name for the DocumentDB .NET Core SDK. We are working to correct that.
The current/latest version is 1.0.0 but if you specify * as above, it will ensure that the latest version is downloaded.

Related

AWS SDK in Visual Studio always exits with a message of saying that it didn't raise a CoreCLR started event [duplicate]

I've been working with AWS lambdas for a few months. I was working with a lambda and it was fine at the end of the day. I came back to work on it the next day, and I can't get Visual Studio to even start the application using the Mock Lambda Test Tool.
I ended up creating an empty lambda that just returns the input (the standard project code that AWS gives you as a template) and that won't even run. I hit the play button to star the Mock Lambda Test Tool, it looks like it will run for a couple seconds, then it closes down. The command window does not even pop up.
This is the code from the template project.
public string FunctionHandler(string input, ILambdaContext context)
{
return input?.ToUpper();
}
This is all I get in the output window of VS:
The target process exited without raising a CoreCLR started event.
Ensure that the target process is configured to use .NET Core. This
may be expected if the target process did not run on .NET Core. The
program '[16700] dotnet-lambda-test-tool-2.1.exe: Program Trace' has
exited with code 0 (0x0). The program '[16700]
dotnet-lambda-test-tool-2.1.exe' has exited with code -2147450726
(0x8000809a).
I have tried re-installing the AWS toolkit, and also tried re-installing Visual Studio. This is an issue with VS 2017 and VS 2019. I just installed 2019 to see if that would fix the issue. Any help would be appreciated.
I came to this question having the very same issue. After installing AWS Toolkit I found that the lambda test tool was not installed and therefore I got the same error just as the OP. The only difference is that I was targeting .Net Core 3.1 and therefore I needed amazon.lambda.testool-3.1. However this answer should work for both scenarios.
Unfortunately I did not have the same luck as the OP of having a nice co-worker that could give me the files I needed. So, if this is also your case please continue reading.
In the official project site, which can be found here, there are the instructions to install the tools. It also says that installing the latest version of AWS Toolkit should be enough to have the tools installed (it was not in my case and probably in yours).
It says that in order to install the tools you should run the following commands:
dotnet tool install -g Amazon.Lambda.TestTool-3.1
or
dotnet tool install -g Amazon.Lambda.TestTool-2.1
depending on which tool you need.
However, running these commands fails with the following message:
The tool package could not be restored.
Tool 'amazon.lambda.testtool-2.1' 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 Core 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
And since the project is still in preview I just had to find the latest stable version in order to specify it in the command. For .net core 3.1 here is the nuget site, there I found version 0.10 to be the latest, so the command should look like:
dotnet tool install -g --version 0.10 Amazon.Lambda.TestTool-3.1
I have faced the same issue and when i tried to install dotnet-lambda-test-tool-3.1.exe using command prompt I got this issue:
Failed to create shell shim for tool 'amazon.lambda.testtool-3.1': Command 'dotnet-lambda-test-tool-3.1' conflicts with an existing command from another tool.
Tool 'amazon.lambda.testtool-3.1' failed to install.
And I did the following to fix issue
Deleted the dotnet-lamda-test-tool-3.1.exe from the installed folder (C:\Users%USERNAME%.dotnet\tools\dotnet-lambda-test-tool-3.1.exe)
Run dotnet tool install -g --version 0.10 Amazon.Lambda.TestTool-3.1 on cmd.
I have faced the same issue and got errors like "dotnet-lamda-test-tool-2.1.exe has exited with code.."
I did the following to fix the issue
Removed the dotnet-lamda-test-tool-2.1.exe from the installed folder
(C:\Users%USERNAME%.dotnet\tools\dotnet-lambda-test-tool-2.1.exe)
Removed the [amazon.lambda.testtool-2.1] folder as well
(C:\Users%USERNAME%.dotnet\tools\tools.store\amazon.lambda.testtool-2.1)
Installed dotnet tool from Developer command prompt using the command
[install -g Amazon.Lambda.TestTool-2.1]
Run the project. It is working
I have seen this issue many time on my system with dotnet-lambda-test-tool-6.0. Only one fix work for me
Remove dotnet-lambda-test-tool-6.0.exe from C:\Users\username.dotnet\tools
Open Command prompt from C:\Users\username.dotnet\tools
run command dotnet tool install -g Amazon.Lambda.TestTool-6.0
For anyone else that hits this same issue, it had to do with the the AWS toolkit install. I did not modify it, but somehow it was no longer working. I tried un-installing and re-installing, but it was still having issues running it. A co-worker sent me the exe and subdirectory that was setup on his machine under C:\Users\%user%.dotnet\tools. The exe is located in this directory, and there is another folder under .store for amazon.lambda.testtool-2.1. That directory had different folders and files than what I was able to install. So I copied in what he had and it worked. There might be a profile file associated to the tools install that points to these folders and files that might need to be modified. Since I was able to fix it with this, I didnt look any further into that.
I had the same issue with my .NET 6.0 lambda project. I installed the tool by executing dotnet tool install --global Amazon.Lambda.TestTool-6.0 --version 0.12.6 as suggested on https://www.nuget.org/packages/Amazon.Lambda.TestTool-6.0
Just ensure it is installed at %USERPROFILE%\.dotnet\tools\dotnet-lambda-test-tool-6.0.exe
I got the same issue with VS2019 with lambda design in 3.1 version and in Output window getting error
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
Then checked the folder having multiple version of lambda-test-tool in path
C:\Users{username}.dotnet\tools
I removed all the lambda-test-tool and installed the required tool only with version 3.1 by command in developer command prompt:
dotnet tool install -g --version 0.10 Amazon.Lambda.TestTool-3.1
Then I can able to debug the lambda

Xamarin.Firebase.Firestore Causes my Xamarin Forms Android Project to Fail Deployment (Xamarin)

I am using Google Firestore in my Xamarin forms app and after updating the Xamarin.Firebase.Firestore Nuget Package to the latest version, I am no longer able to debug my project on Android.
I made a new Xamarin Forms Project to first to check if the error was because of my code or because of an issue with the Nuget Package itself.
I then installed the Xamarin.Firebase.Firestore Nuget Package and quickly found that the problem wasn't with my code, it was with the Nuget Package.
If you are trying to install the Xamarin.Firebase.Firestore Nuget Package and you dont have the Xamarin.AndroidX.Core and Xamarin.AndroidX.Browser Nuget Packages installed, it will say "Could not add Xamarin.Firebase.Firestore" and show a really long error message. This is very annoying because it gives you a novel to read through instead of simply showing a prompt to install the Nuget Packages as dependencies alongside the parent Nuget Package.
Then in order to install the Xamarin.AndroidX.Browser Nuget Package, you first need to install the Xamarin.AndroidX.Core Nuget Package. If you don't install the Xamarin.AndroidX.Core Nuget Package first you will get another long error message saying that you need to install it.
After I install all three Nuget Packages and try to run my Android Project, I get this error message:
/Users/{UserName}/Desktop/FirebaseTests/FirebaseTests/FirebaseTests.Android: Error JAVA0000: Error in /Users/{UserName}/.nuget/packages/xamarin.google.guava/31.1.0.3/buildTransitive/monoandroid12.0/../../jar/guava.jar:com/google/common/annotations/Beta.class:
Type com.google.common.annotations.Beta is defined multiple times: /Users/{UserName}/.nuget/packages/xamarin.google.guava/31.1.0.3/buildTransitive/monoandroid12.0/../../jar/guava.jar:com/google/common/annotations/Beta.class, obj/Debug/lp/102/jl/__reference__guava.jar:com/google/common/annotations/Beta.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/{UserName}/.nuget/packages/xamarin.google.guava/31.1.0.3/buildTransitive/monoandroid12.0/../../jar/guava.jar
com/google/common/annotations/Beta.class
at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:98)
at com.android.tools.r8.D8.main(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /Users/{UserName}/.nuget/packages/xamarin.google.guava/31.1.0.3/buildTransitive/monoandroid12.0/../../jar/guava.jar:com/google/common/annotations/Beta.class
at Version.fakeStackEntry(Version_3.3.28.java:0)
at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:75)
at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:27)
at com.android.tools.r8.internal.Bj.b(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:2)
at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:17)
at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:85)
... 1 more
Caused by: com.android.tools.r8.internal.f: Type com.google.common.annotations.Beta is defined multiple times: /Users/{UserName}/.nuget/packages/xamarin.google.guava/31.1.0.3/buildTransitive/monoandroid12.0/../../jar/guava.jar:com/google/common/annotations/Beta.class, obj/Debug/lp/102/jl/__reference__guava.jar:com/google/common/annotations/Beta.class
at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:14)
at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:33)
at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:10)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:6)
at com.android.tools.r8.graph.B2$a.e(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:105)
at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:25)
at com.android.tools.r8.D8.d(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:606)
at com.android.tools.r8.D8.c(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:1)
at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:24)
... 5 more
Directory 'obj/Debug/lp/102' is from 'Xamarin.Grpc.Stub.dll'. (JAVA0000) (FirebaseTests.Android) java
The error refers to Xamarin.Google.Guava so I thought installing Xamarin.Google.Guava individually would solve the issue but not at all; I am still getting the same error.
Could someone please help me? There is no way I am the only person this is happening to.
You should file the bug, Xamarin.Firebase.Firestore needs to work when installed: https://github.com/xamarin/GooglePlayServicesComponents/issues/new
Aside from that you may try some older version and see if it works, e.g. version 123.0.3.7 seems to work well for me.

Failed to download package - NuGet Packages - Xamarin forms

I've got this error in my Xamarin Forms project for all the packages installed in it:
Failed to download package 'Fody.6.5.1' from 'https://api.nuget.org/v3-flatcontainer/fody/6.5.1/fody.6.5.1.nupkg'.
The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/fody/6.5.1/fody.6.5.1.nupkg' has timed out after 100000ms.
I've cleaned the solution & restoring NuGet Package but I still have the same errors.
You can try to install older versions.May be related to the project.
You can manage to restart VS to get the package to reinstall.And just to confirm, make sure your internet connection active and stable at the time.Also,you can try to install other versions of Fody as Furkan mentioned.

ASP.NET API Project, Microsoft Identity Platform configuration gives error: Unrecognized command or argument '--code-update=true'

In Visual Studio, I'm trying to configure an ASP.NET Web API project to be published to the Azure cloud. Authentication will be done through the Microsoft Identity Platform. Currently, this is not configured in the project's publishing settings:
Clicking "Configure" pulls up a dialog box where I complete a series of simple config steps. At the end, the dialog seems to execute a number of tools/utilities to put in place the settings I just specified. One of these commands it attempts to run is failing:
Inserting code...
dotnet msidentity --update-project --tenant-id [OUR TENANT ID] --username [MY USERNAME] --client-id [OUR CLIENT ID] --project-file-path "[OUR PROJECT PATH].csproj" --calls-graph=True --calls-downstream-api=True --code-update=true --json
Unrecognized command or argument '--code-update=true'
I'm not sure what to do about this, as all these commands are being generated and executed internally. I have the latest version of the Azure.Identity (1.5.0) and Microsoft.Identity.Web (1.21.1) NuGet packages installed. All other Nuget packages are up to date as well.
Any pointers on how I can try to debug this?
I was able to find help and get an answer by posting on the Visual Studio support site:
https://developercommunity.visualstudio.com/t/aspnet-api-project-microsoft-identity-platform-con/1627164
It turns out there are a separate set of packages- besides both NuGet and the standard install of .NET- which I was completely unaware of: "local CLI tools". Specific versions of certain command line tools were created as part of the VS project, and these versions were in fact out of date and so created a conflict with the newer code from NuGet.
Using the .NET CLI, I ran the command dotnet tool uninstall on all local packages for the project, which effectively tells the project to just use the version of the tool present in the current install of the .NET framework, rather than a specific version from a local copy. This fixed the problem.

nuget package , can't install EntityFrameworkCore.sqlserver

Hi I can't install microsoft.entitiyFrameWorkCore.sqlserver via NuGet package in
VS 2019. I am getting this error The feed 'nuget.org
[https://api.nuget.org/v3/index.json]' lists package
'Microsoft.Data.SqlClient.2.0.1' but multiple attempts to download the
nupkg have failed. The feed is either invalid or required packages
were removed while the current operation was in progress. Verify the
package exists on the feed and try again. Unable to find package
'Microsoft.Data.SqlClient.2.0.1'.
PS : my VS version isn't the latest one
It looks it was becaues the very bad internet connection I have , since when I connected to 4g it installed successfully

Resources