I have started a new sample .NET Core 3.1 project to use Gremlin.NET to connect to CosmosDB Graph API and can't seem to get the Gremlin.NET package installed. The problem is when I run dotnet add package Gremlin.NET, I get the following output:
Writing C:\Users\xxx\AppData\Local\Temp\tmp343B.tmp
info : Adding PackageReference for package 'Gremlin.NET' into project 'C:\opt\Source\...\gremlin-spike\gremlin-spike.csproj'.
info : Restoring packages for C:\opt\Source\...\gremlin-spike\gremlin-spike.csproj...
error: The local source 'C:\Program Files\Microsoft SDKs\Service Fabric\packages\' doesn't exist.
The problem is the last line where it is attempting save package into the Service Fabric packages directory, but I no longer have Service Fabric installed and the directory no longer exists. I have looked at all the nuget.config files I can find and none of them have a package source pointing to that directory. How do I reset .NET Core to use the default packages folder location instead of this value?
Create an empty folder here:
C:\Program Files\Microsoft SDKs\Service Fabric\packages
Related
I'm having some troubles with loading the mod_spatialite extension in sqlite in an ASP.NET Core 3.1 application. When I run the code below I get the following error: "SQL logic error The specified module could not be found."
string dbFile = "D:\\Temp\\spatialtest.db";
string connectString = $"Data Source={dbFile};Version=3;";
SQLiteConnection connection = new SQLiteConnection(connectString);
connection.Open();
connection.EnableExtensions(true);
connection.LoadExtension("mod_spatialite");
I reference the System.Data.Sqlite(https://www.nuget.org/packages/System.Data.SQLite/1.0.113.1) package from NuGet. The packages I use for loading in spatialite are found here http://www.gaia-gis.it/gaia-sins/. I tried the packages from the current stable 4.3.0a and the new 5.0.0-RC1, both the amd64 and x86 binaries.
The weird thing is that when I copy the code to an .NET Core Console application or to an .NET Core Class Library(CL) and then reference the CL from the console application it does work.
I don't get why it does work in an Console application and not in an ASP.NET application. Am I missing something? Any help is greatly appreciated!
EDIT: Added test project to Github: https://github.com/RogierB/SQLiteSpatialiteTest
Probably in console application you are using EF? With EF installation for SQLite will be installed all necessary libraries.
Try to add this library
Install-Package SQLitePCLRaw.bundle_e_sqlite3 -Version 2.0.3
I have found a working solution for my problem. I created a new folder and added all the files from the gaia download (http://www.gaia-gis.it/gaia-sins/) to that folder. The next thing I did was adding the newly created folder to the PATH environment variable for my system (Win 10). Restarted Visual Studio and now it does start and I don't even need to have the DLL's in the project/solution anymore because it will take the DLL's from the PATH
when generating a new project xamarin.form prism I get this error when running. With the previous version 2.1.7 it worked for me OK.
It does not allow me to open the Nuget Package since it also gives an error.
Any recommendation?
I saw the 2 posts of this error but they do not apply to me.
Error NETSDK1004 Assets file 'C:\Empresas\Job_Facu\Job\Job.Prism\Job.Prism\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Job.Prism C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 234
The error tells you what to do. Run a NuGet restore. Visual Studio should help you do this automatically. Note that if this occurred after updating dependencies sometimes Visual Studio gets confused and it's best to close Visual Studio and reopen it. This usually gets it to refresh itself so you get the updated package restore.
If that's not working for you, you can download the latest nuget.exe and from the command line navigate to the solution directory and execute the command {path to nuget.exe} restore.
When NuGet performs a restore it generates the project.assets.json file in the obj folder of each project it has restored. This in turn provides MSBuild with the reference information it needs to properly reference your dependencies like Prism and Xamarin.Forms.
I have recently ran into similar issue as well, seemingly out of the blue. I believe upgrading my build machine to the latest VS version (VS for Mac 8.10.4 (build 11))
NETSDK1004: */project.assets.json' not found. Run a NuGet package restore to generate this file.
To fix, I had to run Nuget Restore twice. Once for the shared project directory and once for the iOS project.
If I run the restore just for the Shared/(main.sln file) project directory I get the error.
If I run the restore for the iOS project the build passes but IPA file isn't created.
Need to run both.
Modules used for CI/CD build in Azure Devops Pipeline
I created a new Xamarin Forms solution with .Net Standard 2.0
It builds OK.
Then I add a NuGet Xamarin.Forms.Maps:
and appear this Build error:
Severity Code Description Project File Line Suppression State
Error An error occurred trying to install required android components on Project 'eCidadaoMobile.Android'.
Project 'eCidadaoMobile.Android' requires the following components installed on your machine:
Xamarin.GooglePlayServices.Base
JavaLibraryReference: https://dl-ssl.google.com/android/repository/google_m2repository_r24.zip-m2repository/com/google/android/gms/play-services-base/8.4.0/play-services-base-8.4.0.aar-8.4.0
AndroidResources: https://dl-ssl.google.com/android/repository/google_m2repository_r24.zip-m2repository/com/google/android/gms/play-services-base/8.4.0/play-services-base-8.4.0.aar-8.4.0
Xamarin.GooglePlayServices.Basement
JavaLibraryReference: https://dl-ssl.google.com/android/repository/google_m2repository_r24.zip-m2repository/com/google/android/gms/play-services-basement/8.4.0/play-services-basement-8.4.0.aar-8.4.0
AndroidResources: https://dl-ssl.google.com/android/repository/google_m2repository_r24.zip-m2repository/com/google/android/gms/play-services-basement/8.4.0/play-services-basement-8.4.0.aar-8.4.0
Xamarin.GooglePlayServices.Maps
JavaLibraryReference: https://dl-ssl.google.com/android/repository/google_m2repository_r24.zip-m2repository/com/google/android/gms/play-services-maps/8.4.0/play-services-maps-8.4.0.aar-8.4.0
AndroidResources: https://dl-ssl.google.com/android/repository/google_m2repository_r24.zip-m2repository/com/google/android/gms/play-services-maps/8.4.0/play-services-maps-8.4.0.aar-8.4.0
Please double-click here to install it.
Intallation Errors: XA5207 Please install package: 'GPS Base' available in SDK installer. Java library file 'C:\Users\tonyv\AppData\Local\Xamarin\Xamarin.GooglePlayServices.Base\8.4.0\embedded\classes.jar' doesn't exist.
XA5207 Please install package: 'GPS Basement' available in SDK installer. Java library file 'C:\Users\tonyv\AppData\Local\Xamarin\Xamarin.GooglePlayServices.Basement\8.4.0\content\classes.jar' doesn't exist.
XA5207 Please install package: 'GPS Maps' available in SDK installer. Java library file 'C:\Users\tonyv\AppData\Local\Xamarin\Xamarin.GooglePlayServices.Maps\8.4.0\content\classes.jar' doesn't exist. 0
If I double-click the error message, nothing happens.
How and where to install these required files?
Under the path C:\Users\UserName\AppData\Local\Xamarin, delete the Xamarin.GooglePlayServices folders, in order to redownload them during the next startup.
I'm getting
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
in VSTS build using Hosted2017 build agent after I upgraded my aspnetcore app to netcoreapp2.0 and my libraries to use netstandard2.0.
Works fine locally.
I've edited my build definition to use .net core build task v2.* preview:
here is the build log:
Current agent version: '2.120.2'
Download all required tasks.
Downloading task: DotNetCoreCLI
Starting: Get Sources
Syncing repository: Liero/vyvojari-sk (GitHub)
...details ommited
HEAD is now at e448a25... Upgraded to .NET Core 2.0
Finishing: Get Sources
Starting: Restore
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.0.5
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
SYSTEMVSSCONNECTION exists true
Downloading: https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
Caching tool: NuGet 4.0.0 x64
Using version: 4.0.0
Found tool in cache: NuGet 4.0.0 x64
Saving NuGet.config to a temporary config file.
Can\'t find loc string for key: NGCommon_NoSourcesFoundInConfig
NGCommon_NoSourcesFoundInConfig d:\a\1\Nuget\tempNuGet_734.config
"C:\Program Files\dotnet\dotnet.exe" restore d:\a\1\s\src\CommandStack\CommandStack.csproj --configfile d:\a\1\Nuget\tempNuGet_734.config --verbosity Detailed
Restoring packages for d:\a\1\s\src\CommandStack\CommandStack.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. [d:\a\1\s\src\CommandStack\CommandStack.csproj]
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.props.
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.targets.
Writing lock file to disk. Path: d:\a\1\s\src\CommandStack\obj\project.assets.json
Restore failed in 115.64 ms for d:\a\1\s\src\CommandStack\CommandStack.csproj.
Errors in d:\a\1\s\src\CommandStack\CommandStack.csproj
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
NuGet Config files used:
d:\a\1\Nuget\tempNuGet_734.config
Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
Packages failed to restore
******************************************************************************
Finishing: Restore
******************************************************************************
and here is the source code: https://github.com/Liero/vyvojari-sk/tree/e448a25fb8c481704e9102aaaeb8b84b9aee7b02
Update 18/09/2017
Step 2 is no longer needed. I've left it in the solution though as it may still help some people. Thanks, #Liero for point this out.
Original Answer
I've just experienced this problem too and solved it by doing three things:
Use the .NET Core SDK(! - not runtime!) version 2.0.0:
Use the latest NuGet feed (4.3.0):
Restore your packages:
Update
It's worth mentioning here that you should specify where you get your NuGet packages from. Most applications will probably just use the NuGet.org feed, as per the screenshot (see small checkbox), but you may have your custom feeds specified in a NuGet.config file. In that case, tick 'Feeds in my NuGet.config' and then specify the path to that file.
To illustrate the order, this is my working queue:
I hope this helps you and anyone else who has come up against this problem. If you have any questions, let me know. :)
You should select Feed(s) I select here for Feeds to use option. If you leave Use packages from this VSTS/TFS feed empty, packages will be downloaded from https://dist.nuget.org/.
Else, if you want to use Feeds in my NuGet.config as Feeds to use, you should specify the path for your NuGet.config file.
I have received a similar error after generating a project using dotnet new angular which created a project relying on netcoreapp2.0. Inspection of project properties revealed that version 2.0 was not properly recognized (did not appear in the installed framework list).
Solution was to update Visual Studio 2017, as the minimum version required to support netcoreapp2.0 projects seems to be 15.3.1.
What worked for me was installing .NET Core SDK 2.0 and making the following changes:
in .csproj:
change
<TargetFramework>netcoreapp1.1.0</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
and in global.json:
"sdk": { "version": "1.1.0" }
to
"sdk": { "version": "2.0.0" }
I didn't know how to use Chris Paton' solution
Updating the Visual Studio 2017 to latest 15.4.1 version resolved the problem for me.
I created a MVC 6 project with RC1 and added reference to "Microsoft.Data.SqlXml" with no problem. When I migrated to RC2, I can not add the reference to "Microsoft.Data.SqlXml". I get an error message ".Net Core projects only support referencing .NET framework assemblies in this release. To reference other assemblies, they need to be included in a NuGet package and reference that package." Is there a easy way I can add the reference?
I'm finally able to add the reference "Microsoft.Data.SqlXml" by creating NuGet package, to the project migrated to RC2.
Publish RC1 project to file system and find out the package folder "Microsoft.Data.SqlXml" under "PublishOutput"
Download Nuget Package Explorer and open the .nuspec file in "Microsoft.Data.SqlXml" package folder.
Edit the files .nuspec, project.json, project.lock.json in Nuget Package Explorer, change all words "DNX" -> ".NETFramework", and "Save As" package file Microsoft.Data.SqlXml.nupkg.
In VS 2015, Tools -> NuGet Package Manager -> Setting, add local folder to package source list, then copy the .nupkg file to the folder
Install the Microsoft.Data.SqlXml NuGet package from the local source
I don't know why MS made the thing so complicated, 2 seconds work in RC1 but took me one day to figure it out in RC2.