No option for "Add Client Side Library" on Visual Studio Mac 2019 - asp.net-core-2.2

Can't see any option to add client side library on Visual Studio for Mac 2019 (Version 8.3.3).
Seems to be supported as I seen a few tutorials on a Mac for it but can't seem to find the option myself.

You have to run the following command to install libman on your macOS:
dotnet tool install -g Microsoft.Web.LibraryManager.Cli
After running the above command try:
libman --version
If you get the error Command not found: libman
Then also run the following command:
export PATH="$PATH:/Users/username/.dotnet/tools"
where username would be your macOS user.

There is a separate Library Manager extension you can install which adds support for LibMan in Visual Studio for Mac.
Otherwise you can install the libman global tool and use the command line.
dotnet tool install -g Microsoft.Web.LibraryManager.Cli

Go to Menu Visual Studio, Extensions, Gallery, add library manager, restart Visual studio, and in the Add client-said Library solution, that's it

Related

Bash terminal in Visual Studio dotnet not found

I have debian 11 installed in wsl2 on windows 10. I use the dotnet cli tools in visual studio and cmd windows but much prefer the linux syntax. The sdk commands are not exposed to wsl apparently as I get "bash: command dotnet not found" errors. Because WSL is essentially mapping linux commands to windows I don't think I should be installing the dotnet sdk again for linux, but can't really find any confirmation of that. Anyone here doing this who can advise? Just don't want to have to maintain two sets of the dotnet sdk if WSL does not require it.
The sdk commands are not exposed to wsl apparently as I get "bash: command dotnet not found" errors.
That's because WSL does not run Windows executables - it is, after all, a Linux subsystem.
I don't think I should be installing the dotnet sdk again for linux
You have two choices:
Use the Windows subsystem (drop WSL),
install the Linux applications you want to run.

How do I use Visual Studio 2019 to remotely debug a .NetCore application on a Hyper-V Linux VM?

I am attempting to remotely debug a .NetCore application in Ubuntu Linux from Visual Studio 2019 in Windows 10. I can see the remote ipaddress (ping thru command line). I can RDT to the ipaddress. I can successfully transfer files to it via WinSCP.
I created a simple .NetCore "HelloWorld" app and copied onto the Linux VM.
I used the following commands to build and publish:
dotnet build -r linux-x64
dotnet publish --self-contained -r linux-x64
I ran the following command on the Linux VM to ensure that ssh is functional:
sudo apt-get install openssh-server unzip curl
The app is running on Linux.
From VS I try to attach to the process:
I get prompted for logon:
I get the following error:
Is there a step I'm missing somewhere?
Is there a configuration/permissions issue I am unaware of?
Thanks, JohnB
Microsoft has documented debugging a Linux target from a Windows development machine at https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-dotnet-core-linux-with-ssh?view=vs-2022
Unfortunately, using that method, you will need to manually deploy and manually attach the debugger. If you'd like Microsoft to change that, then it would be wise to upvote this issue: https://developercommunity.visualstudio.com/t/Convenient-way-to-add-a-remote-debug-con/917516
A 3rd party developer has created a Visual Studio extension that provides this missing feature to Visual Studio. It can be downloaded from https://github.com/radutomy/VSRemoteDebugger
I had the same problem initially because I didn't enter the connection target in the first screen.
After having entered the correct target myusername#192.168.178.95 in the first screen the second screen did not show up any longer and I got the expected list of processes

Can not use or detect global .net tools on Linux

I have installed the dotnet-ef and a number of other packages but for some reason, I can't use them.
I added $HOME/.dotnet/tools as shown here:
https://learn.microsoft.com/en-us/dotnet/core/tools/troubleshoot-usage-issues
but running dotnet tool list still shows no packages.
Please note that dotnet tool list command checks for local tools by default. Try dotnet tools list -g to look for globally installed tools. Make sure your PATH contains the global tools folder location before running the installed tool. You can check your PATH by running echo $PATH. You can also check globally installed tools by running dotnet tool list --tool-path $HOME/.dotnet/tools. Following steps work for me:
dotnet tool install --global dotnet-ef
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet tool list -g
dotnet-ef
HTH

R Xgboost: How to compile xgboost with GPU support on windows 10; can't find Visual Studio [duplicate]

When I am trying to install CMake I get the error:
Visual Studio 15 2017 could not find any instance of Visual Studio.
I am using Windows 7 and Visual Studio 2017. The CMakeOutput.log file writes:
The system is: Windows - 6.1.7601 - AMD64
Any ideas?
I ran into the same error and performed the following steps to resolve the issue:
Open Visual Studio
Go to Tools -> Get Tools and Features
In the "Workloads" tab enable "Desktop development with C++"
Click Modify at the bottom right
These steps resulted in the "Visual C++ tools for CMake" feature being installed, but the other optional C++ features included in this workload may also helpful for what you are trying to do.
After the Visual Studio updater finishes installing try re-running the command. You may need to open a new command window.
In my case, I installed Visual Studio, selecting the workloads and modules that I wanted, but I ignored the request to reboot, assuming that shutting down the computer at the end of the day and restarting it the following day would suffice. I was wrong.
The following day I tried a cmake build and got the "could not find any instance of Visual Studio" error. After several attempts to resolve, I re-ran the installer, made no changes to the configuration, and clicked Modify. This time I let it reboot the computer. The reboot took a long time. After which my cmake build worked.
If you have already installed the workload Desktop development with C++ and still getting the following errors while using visual studio 2022 for flutter
Generator
Visual Studio 16 2019
could not find any instance of Visual Studio.
Building Windows application...
Exception: Unable to generate build files"
Solution: Follow these steps,
Edit your_flutter_path\packages\flutter_tools\lib\src\windows\build_windows.dart, and change the constant on line 28 from Visual Studio 16 2019 to Visual Studio 17 2022
Delete flutter_tools.stamp and flutter_tools.snapshot from your_flutter_path\bin\cache\
Run flutter clean in the project
I had the same issue "could not find any instance of Visual Studio"
but with Visual Studio 2019 (Community Edition) and I just had to configure the VS160COMNTOOLS variable so that CMake correctly detects Visual Studio.
export VS160COMNTOOLS="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools"
(cf https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html)
With Visual Studio 15 2017, the variable you need should be VS150COMNTOOLS.
(cf https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html)
NB: in my case, in a Travis-CI workflow, I installed Visual Studio using the commands (no need to reboot):
choco install visualstudio2019community
choco install visualstudio2019-workload-nativedesktop # required
With only the first package, CMake detection of VS2019 failed.
I was configuring a Jenkins build node and could successfully run CMake GUI manually but command line use or builds using the CMake plugin would fail with:
Visual Studio 16 2019 could not find instance of Visual Studio.
-A x64 parameter was added with no change in result.
The problem was that CMake could not determine the Windows SDK version.
By adding CMAKE_SYSTEM_VERSION parameter CMake was then able to find Visual Studio.
-D CMAKE_SYSTEM_VERSION=10.0.18362.0 (use your windows SDK version)
Environment:
windows 10 system build: 19042
CMAKE 3.19.4
VS 2019 Professional 16.8.4
Jenkins 2.235.1
Full command line that worked:
"C:\Program Files\CMake\bin\cmake" -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE=Release -A x64 -D CMAKE_SYSTEM_VERSION=10.0.18362.0
When using VS 2017, be aware that this is really VS 2015, and CMake identified it as VS 2017 2022 which is not the version of VS 2017 I had, that gave me this error. So the conclusion I offer is to try different versions, specifically the 2015 one.
I had a similar issue where installing libzmq in my npm project was throwing the same error and that wasn't getting solved by enabling "msbuild" under "Desktop development with C++" in the Visual Studio installer.
My solution ended up being to reinstall the Windows build tools for npm with the following command.
npm install --global windows-build-tools
Note: Remember to run the command prompt (or whatever terminal you are using) as admin before running this.
If the CMake used to work with the installed Visual Studio and is broken someday, then the problem could be VS requires system reboot to complete some update.
For quick verification, rename HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\Setup\Reboot to like HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\Setup\Reboot.bak, then re-run cmake which should succeed. Don't forget to rename the registry back and reboot the system if this is the problem.
In my case, I was selecting different version of visual studio in that configuration dialog box whereas I installed different version.
Do select the same version.
Above solutions did not solve this issue for me. After installing node.js from https://nodejs.org/en/download/ apparently a correct version of windows-build-tools was installed
I reinstalled the Visual Studio 2019(my former one is 2017 version ) with all those settings required(my cmake version is 3.23.0),and it works. So try to install different versions.
In my case, the problem was gone after I deleted the previous cmake result directory and then ran cmake again.
if you have installed two or more Windows 10 SDK, delete them excluding latest one.
Try downloading the windows-build-tools package.
npm install --global --production windows-build-tools --vs2015
This step should be the end-all-be-all solution to fixing node-gyp problems. For most people, that’s true. NPM has a package called windows-build-tools that should automatically install everything you need to get node-gyp working, including the Microsoft build tools, compilers, Python, and everything else required to build native Node modules on Windows.

How to restore an ASP.NET Core project with Ubuntu

Recently, I created an asp.net core project using Visual Studio Code on Windows and pushed it to GitHub. When I cloned the repo from GitHub and attempted to do a dotnet restore on the project on Ubuntu, an error message stating there was no project.json file was returned. Can anyone point me to a resource that will show me how to properly restore a .net core project from a Linux machine? Thanks!
So it seems like on each of your machines you are running different versions of the .net core SDK.
A big caveat with what you are trying to do. Are you trying to use Project Rider from Jetbrains on Linux? This only works with project.json (As of the time of this post) so be wary of that.
Now there are two ways to do this. If you are wanting the very latest on Linux and don't care about using Rider, then you can go here : https://github.com/dotnet/core/blob/master/release-notes/download-archive.md and download the latest release for both Linux and Windows, install on both and you should be good to go.
If you do care about using Rider or you aren't ready to be strapped in for the wild ride of the latest release. Then you can do the following.
Find what version of the SDK you have on linux by typing into a terminal the following :
dotnet --version
This will spit out what version you have on linux. Go here and download the same version for windows and install it on your windows machine (https://github.com/dotnet/core/blob/master/release-notes/download-archive.md).
Now BEFORE you create a project, create a solution folder and create a file in it called global.json. Inside that put the following :
"sdk": {
"version": "1.0.0-preview2-003131"
}
Where the SDK version matches what you got from your linux terminal. Now create a folder for your project inside the solution folder. Run "dotnet new -t web" or a similar command to create your project. It will inspect the SDK version of the global.json and create a project with the tooling that matches. You should then be able to shift this project around any machine that has the same SDK installed, even if it also has the latest SDK's also.
If you do not create the global.json, it defaults to the latest version (Atleast on Windows).
Read a bit more about it here : http://dotnetcoretutorials.com/2017/02/17/developing-two-versions-net-core-sdk-side-side/

Resources