I'm just starting out with a new Console Application project in VS Code and I need to add a reference to my project for Microsoft.SharePoint.Client using:
dotnet add package Microsoft.SharePoint.Client.dll --version 15.0.4420.1017
However the console returns the following and the .csproj file does not change:
Determining projects to restore...
Writing C:\Users\usr1\AppData\Local\Temp\tmpC9C5.tmp
info : Adding PackageReference for package 'Microsoft.SharePoint.Client.dll' into project 'C:\Users\usr1\repo\TstApi\TstApi.csproj'.
info : Restoring packages for C:\Users\usr1\repo\TstApi\TstApi.csproj...
error: NU1101: Unable to find package Microsoft.SharePoint.Client.dll. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
error: Package 'Microsoft.SharePoint.Client.dll' is incompatible with 'all' frameworks in project 'C:\Users\usr1\repo\TstApi\TstApi.csproj'.
Any assistance with this error would be appreciated:
error: NU1101: Unable to find package Microsoft.SharePoint.Client.dll. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
EDIT:
Here's the build error:
dotnet build
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
C:\Users\usr1\repo\TstApi\Program.cs(2,17): error CS0234: The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\Users\usr1\repo\TstApi\TstApi.csproj]
Build FAILED.
C:\Users\usr1\repo\TstApi\Program.cs(2,17): error CS0234: The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\Users\usr1\repo\TstApi\TstApi.csproj]
0 Warning(s)
1 Error(s)
And here's my csproj and the beginning of my program.cs: