Visual Studio 2019 connection problem to NuGet - nuget

I reinstalled (clean) Visual Studio 2019 (Microsoft Visual Studio Community 2019 Version 16.8.5) and I get error when I try to clean solution, it complains about connection to https://api.nuget.org/v3/index.json.
When I copy paste the link to web browser I see all the packages but VS cannot reach any package.
When I rebuild I get all this error: 'obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
Then I do from NuGet Console > dotnet restore and I get error:
PM> dotnet restore
Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.103\NuGet.targets(131,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\Program Files (x86)\Microsoft V
isual Studio\2019\Community\MyProjects2019\source\repos\Bank\Bank.sln]
C:\Program Files\dotnet\sdk\5.0.103\NuGet.targets(131,5): error : The SSL connection could not be established, see inner exception. [C:\Program Files (x86)\Microsoft Visual Studio\
2019\Community\MyProjects2019\source\repos\Bank\Bank.sln]
C:\Program Files\dotnet\sdk\5.0.103\NuGet.targets(131,5): error : The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot [C:\Program Files (x86
)\Microsoft Visual Studio\2019\Community\MyProjects2019\source\repos\Bank\Bank.sln]
PM>
I have been trying for 4 days to resolve this problem without success, any help, any tips.
Thanks

Related

Nuget is not installed. CMake Error at .../CMakeLists.txt:29 Integrity check for .../windows/nuget.exe failed

I get this error when I want to run my project in windows mode.
Nuget is not installed.
CMake Error at flutter/ephemeral/.plugin_symlinks/webview_windows/windows/CMakeLists.txt:29 (message):
Integrity check for F:/flutter_projects/my_project_name/build/windows/nuget.exe
failed.
Exception: Unable to generate build files
But nuget had been installed before. I can run my other flutter project in windows with no errors. path to nuget.exe exists in environment variables.
How can I solve this?

MSBUILD getting failed with error MSB4062

Getting error while running build task in VSTS devops.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(477,5): Error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly \Extensions\Microsoft\SQLDB\Dac\150\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly 'file:///C:\Extensions\Microsoft\SQLDB\Dac\150\Microsoft.Data.Tools.Schema.Tasks.Sql.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Use
/p:StyleCopEnabled=false for .netFramework with msbuild
-p:StyleCopEnabled=false for dotnetcore with dotnet publish
MSBUILD getting failed with error MSB4062
According to the error messages and the comments you posted, it seems you are build the the project that developed by Visual Studio 2017, but build it with old Visual Studio on Azure Devops.
To resolve this issue, you can try to install the Visual Studio 2017 on your private agent.
Hope this helps.

Cordova app for Windows, NuGet fails to get correct version of System.Collections.Specialized

I'm tearing my hair out trying to build a windows app using Cordova. The build error I'm getting is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(377, 5):
error : The package System.Collections.Specialized with version 4.0.0
could not be found in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\.
Run a NuGet package restore to download the package.
[C:\cygwin64\home\Owner\src\apps\mytestapp-
gen\platforms\windows\CordovaApp.Windows10.jsproj]
In visual studio, I attempt to add the version of the package to the project and I get the following error:
Severity Code Description Project File Line Suppression State
Error Could not install package 'System.Collections.Specialized
4.0.0'. You are trying to install this package into a project that targets
'native,Version=v0.0', but the package does not contain any assembly
references or content files that are compatible with that framework. For
more information, contact the package author.
Can anyone advise how to resolve this?
I've looked at this very old question How can I make my managed NuGet package support C++/CLI projects? but I can't find anything (particually from the VS2017 era) that helps
May be, this helps others to solve the issue:
My Visual Studio 2017 installation must obviously have been damaged when removing the Visual Studio 2015 installation from that same machine. After I performed a repair of Visual Studio 2017 via Visual Studio Installer the isuue disappeared.

Visual studio 2017 migrations

In Visual Studio 2017 I created a net core 2 web app. In package manager console I typed
update-database
and I received the following error
CREATE DATABASE [Potos.Travel.Web];
System.Data.SqlClient.SqlException (0x80131904): CREATE FILE encountered operating system error 5(Access Denied) while attempting to open or create the physical file 'C:\Users\grkouPotos.Travel.Web.mdf'.
I noticed that the file name 'C:\Users\grkouPotos.Travel.Web.mdf' should be
'C:\Users\grkou\Potos.Travel.Web.mdf' there is a backslash missing.
My USERPROFILE is c:\users\grkou
How can I fix this

NuGet restore during first asp.net vNext project

Today I installed ASP.NET 5 on windows and begun creating my first application in Visual Studio 2015.
When the project loads I get an error: "Package restore failed", specifically the following error:
Restore failed Det gick inte att hitta en del av s�kv�gen C:\Users\h\.dnx\packages\Microsoft.Win32.Primitives\4.0.0\Microsoft.Win32.Primitives.4.0.0.nupkg.sha512. NuGet Config files used:
C:\Users\h\AppData\Roaming\NuGet\nuget.config
C:\Users\h\documents\visual studio 2015\Projects\NextTest\nuget.config
Feeds used:
https://api.nuget.org/v3-flatcontainer/
C:\Program Files (x86)\Microsoft Web Tools\DNU
When I look for the missing file I find the following path missing:
C:\Users\h\.dnx\packages\Microsoft.Win32.Primitives\4.0.0\Microsoft.Win32.Primitives.4.0.0.nupkg.sha512
But this one exists, note the extra 0 in the version:
C:\Users\h\.dnx\packages\Microsoft.Win32.Primitives\4.0.0.0\Microsoft.Win32.Primitives.4.0.0.0.nupkg.sha512
How would I go about to solve this?
I've tried to search through the project files but no mention of neither Primitives nor verion 4.0.0.
The "Solution DNX SDK version" is 1.0.0-beta8, (beta5 was also available but not selected).
Delete C:\Users\h.dnx\packages folder and try running "dnu restore" command.