Missing required property 'OutputPath' for project type 'PackageReference' - msbuild

I'm trying to run the following command thru Jenkins Pipeline
bat 'nuget restore mySolution.sln -MSBuildPath "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin"'
but i'm getting error saying
Invalid restore input. Missing required property 'OutputPath' for
project type 'PackageReference'. Input files: C:\Program Files
(x86)\Jenkins\workspace\My Project Build
Pipeline\myProject\myProject.csproj.
I tried
bat label: '', script: '"C:\\Package tools\\nuget.exe" restore "C:\\Program Files (x86)\\Jenkins\\workspace\\My Project Build Pipeline\\myProject\\myProject.csproj" -MSBuildPath "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin"' // Restore packages.
I'm expecting all the NuGet packages to get installed as we 'Restore NuGet Packages' in Visual Studio.

Apparently you are using VS 2015 tools (MSBuild 14) and/or an older nuget.exe (< 4.0.0) to work on projects using the PackageReference way of referencing NuGet Packages. Use newer tools (Nuget 4+, VS / Build Tools 2017+) to fix this issue.

I fixed this problem by running the powershell command:
Install-Module VSSetup -Scope CurrentUser

Related

edge-js build failing with nw-gyp

Description
I want to use edge-js with nw.js. And as edge-js is not pure js package , I have to rebuild it with nw-gyp to get it working.
(https://github.com/nwjs/nw.js/wiki/using-node-modules)
Tried to re-build edge-js with nw-gyp, but facing compilation issues. The error snapshot is attached
Followed below 2 links to install nw-gyp
https://github.com/nwjs/nw-gyp#installation
Build edge-js with nw
https://github.com/nwjs/nw.js/wiki/Build-native-modules-with-nw-gyp
Package version
"edge-js": "^15.5.2"
Commands used to build
nw-gyp configure --target=0.42.3
nw-gyp rebuild --target=0.42.3
nw.js v0.42.3
Error Message & Stack Trace
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h(16): error : invalid preprocessing directive [E:\compile_node_modules\node_modules\edge-js\build\edge_nati
veclr.vcxproj]
In file included from ..\src\dotnet\utils.cpp:1:
In file included from ..\src\dotnet/edge.h:22:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h:17:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\gcroot.h:42:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\msclr/gcroot.h(58): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
In file included from ..\src\dotnet\utils.cpp:1:
In file included from ..\src\dotnet/edge.h:22:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h(29): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h(30): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h(31): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h(32): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\vcclr.h(44): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
In file included from ..\src\dotnet\utils.cpp:1:
..\src\dotnet/edge.h(24): error : invalid preprocessing directive [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
..\src\dotnet/edge.h(25): error : invalid preprocessing directive [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
..\src\dotnet/edge.h(27): error : use of undeclared identifier 'System' [E:\compile_node_modules\node_modules\edge-js\build\edge_nativeclr.vcxproj]
Relevant Information
Environment: Windows_NT 10.0.19041
npm configurations
\edge-js> npm config get
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.13.4 node/v12.14.1 win32 x64"
; userconfig C:\Users\<user>\.npmrc
msvs_version = "2015"
node_gyp = "C:\\Users\\<user>\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
python = "python2.7"
; globalconfig C:\Users\<user>\AppData\Roaming\npm\etc\npmrc
node_gyp = "C:\\Users\\<user>\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
; builtin config undefined
prefix = "C:\\Users\\<user>\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; cwd = E:\compile_node_modules\node_modules\edge-js
; HOME = C:\Users\<user>
; "npm config ls -l" to show all defaults.
It may be related to Python 3. Node-gyp was originally based on Python 2. It has been transitioning to Python 3 for the past few years.
* 2019 - Node-gyp 5.x started adopting Python 3
* 2020 - Node-gyp 6.x started to work with Python 3
* 2020 - Node-gyp 7.x works with Python 3
* 2021 - Node-gyp 8.x removes all Python 2 support, only supports Python 3
Source: Node-gyp changelog
NW-gyp was based on Node-gyp with some tweaks, back when it was using Python 2. It has not been updated to support Python 3. So if you are using newer versions of NW.js, that come with newer versions of Node, and you have newer versions of npm globally installed, it may be trying to use Python 3 stuff with Node-gyp, which doesn't support that. This is all a guess on my part, I know very little about Node-gyp/NW-gyp/Python.
If this hunch is correct then you could try using an older version of NW.js. Node-gyp 5 started Python 3 adoption on 2019-06-13, so the latest node/npm before that would be Node 12.4.0 (2019-06-04) and npm 6.9.0. The version of NW.js that ships with Node 12.4.0 is v0.39.2.
Source: Node.js Previous Releases
Source: NW.js Official versions.json
If you don't have nvm or nvm-windows installed, uninstall Node.js and npm first, so you don't have globally competing versions.
Install nvm or nvm-windows
https://github.com/nvm-sh/nvm
https://github.com/coreybutler/nvm-windows
Use nvm/nvm-windows to install Node.js 12.4.0 (should also install npm 6.9.0)
nvm install 12.4.0 && nvm use 12.4.0
Delete your node_modules
npm install --save-dev nw#0.39.2-sdk
npm install
npm start 🤷‍♀️
That's all I got. Hopefully someone else can help more, or this at least points you in the right direction.

cant Install [.net core] packages using visual studio code(dotnet cli)

I using the latest asp core 3.1 framework. I am trying to setup my database but there is an issue. I can't seem to install the following packages
dotnet tool install --global dotnet-ef
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet add package Microsoft.EntityFrameworkCore.SQLite
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
I get the following errors. will appreciate it if any one can help with
a solution.
error NU1100: Unable to resolve 'dotnet-aspnet-codegenerator ' for '.NETCoreApp,Version=v3.1'.
error NU1100: Unable to resolve 'dotnet-aspnet-codegenerator ' for '.NETCoreApp,Version=v3.1/any'.
The tool package could not be restored.
Tool 'dotnet-aspnet-codegenerator' 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.
This happens when I try to install any of the packages.

hiredis rebuild with .net framework 2.0 error

I tried remove and install the related files for .net framework 3.5 (include the 2.0). Suggested in this stackoverflow
Tried to install visual studio 2005 as suggested in the second thing that was suggested in the error.
I cannot find hiredis folder under node_modules.
Other thing I tried to clean my cache and delete node_modules and reinstall again as suggested in this stackoverflow.
MSBUILD :
error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this,
1) install the .NET Framework 2.0 SDK,
2) install Microsoft Visual Studio 2005 or
3) add the location of the component to the system path if it is installed elsewhere.
[D:\path\src\node_modules\hiredis\build\binding.sln]
The full error find in the image.
This apparently is a common error people come across as a window user.
If you are recently update your Visual studio to a new version such as 2012 and above will see similar from the above.
There are articurs on this, if you use the right search keys, here is one of them and the author explains it in details. link
three solutions:
1) npm install -g windows-build-tools stackoverflow
2) install visual studio 10 -> npm clear cache --force -> delete node_modules/ -> delete package-lock.js npm config set msvs_version 2010 -g
3) manually download the neccaries files then npm config set msvs_version -g github

Error: failed to retrieve information about - when trying to install SpaTemplates

I'm following this tutorial here
When I run this command
dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
I get this error
Restoring packages for C:\Users\admin\.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Failed to retrieve information about
'Microsoft.NETCore.Targets' from remote source 'C:\Program Files\Microsoft SDKs\Service Fabric\packages\'.
[C:\Users\admin\.templateengine\dotnetcli\v1.0.4\scratch\restore.csproj]
How should I resolve this and how is this even linked to service fabric?
Find your local nuget.config with:
%appdata%/NuGet/NuGet.Config
And remove your local nuget package source.
I Hope it helps.

How do you use npm in Visual studio 2017 without project.json file?

Now that they removed project.json in Visual Studio 2017, but npm used to install packages in the devDependencies in that file, how do we use npm to install packages now? If I create a package.json file, wouldn't that be redundant considering the existing MyProject.csproj file?
When you install library via terminal and click on dependencies in the solution project, you can see that library will be marked as extraneous.
Extraneous means a package is installed but is not listed in your project's package.json
So use package.json if you want to install packages.