Visual Studio Code only compiles when launched from project folder on Linux - visual-studio-code

I have Visual Studio Code installed in Ubuntu 20.04. I love how it works. I installed it from the tar ball. Same with the SDK. I just found that those appear to work better than installing from deb packages.
I created a desktop file so I could add Visual Studio Code to the dock and launch it that way, but what I've noticed is that projects won't compile. I get errors stating it can't find the project even though the errors are listing the folder where the items exist.
The only way I can get it to work is to:
Open a terminal.
Navigate to the folder where the project files reside.
Launch code from the command line.
Then it works. Otherwise, I get a pop-up error that says "The preLaunchTask 'build' terminated with exit code -2" and then the terminal window is filled with errors.
Here's the last of the error messages and then I opened up a terminal and it shows that I'm in the folder for the project and the csproj exists there:
This also happens if I install Visual Studio code from a repository. It seems launching it from the Unity desktop breaks something. But if I launch it from the command line in a terminal session from the folder where the project resides, then the problem goes away.
I can also reproduce this error from the command line if I launch Visual Studio Code from a different folder than the project I'm trying to compile.
Is this common? Just curious. I'm wondering if because when I launch it from the Unity desktop, it's launching under a different

I got it working under 20.04. I must have done something wrong so I did a wipe of the .NET Core install and reinstalled it all using the bash shell script and then was able to install Code via Software Installer tool. Not sure why it didn't work before, but it works now.

Related

Not able to open VS Code from Terminal in my MacBook BigSur11.3.1

Good day community. I have installed VS Code in my MacBook Air M1 chip running on BigSur 11.3.1 but whenever I set the code command in PATH (using Command+Shift+P) it only appears to be working for current session and doesn't work if I restart VSCode. I have to set the code command in PATH again. Please help me in configuring code command permanently so that i can open VSCode from any directory whenever I want. Thanks
I think I have got the solution. After installing VSCode in your Mac (which will be in download folder) move VS Studio Code.app file to Application Folder and then again install the code command in PATH from VSCode(using Command+Shift+P) and thats it.

setting up visual studio code for c++, but unable to compile

I have installed visual studio 2019 which works fine for c++ but unable to create folders and sections to store multiple code files. So thought of switching to visual studio code and followed all tutorials available on youtube and documentation. But Visual studio IDE has got nothing showing up when Run Build task is initiated, which is expected to show the c++ extension downloaded. Mingw64 is installed and checked in the terminal too.
no output or terminal opened on Run
compiler installation checked
From the image attached regarding no output in the terminal or terminal opened, it looks like the exe is made because it says 'Build finsihed succesfully'. You'll need to run this executable from the terminal.
For this, if youre in the same directory all you have to do is type the filename. helloworld.exe in the cmd, if its powershell, then ./helloworld.exe. (Also note that for exe files you dont need to explicitly mention .exe at the end of the file name)
The powershell method should work on cmd too.
And if youre not in the same directory as the executable, you can either change directory by typing cd path/to/file and proceed as above, or run directly by typing path/to/file/helloworld.exe. where path/to/file is the directory of your helloworld.exe file

Unable to install VisualStudio Code in Windows 10

I have a Windows 10 with the latest patches and downloaded the VisualStudio Code setup from the official page but when I double click the .exe nothing happens, it does open a dialog and no error is displayed, just nothing happens, I tried running it as admin, restarting the machine multiple times, always the same result.
It just happens with this specific .exe, I tried with several other installations and it works fine.
Is there a way to see what could be blocking the installation?
Use Chocolatey to install visual studio code if you can't install it by clicking the exe file. See the folowing link:
chocolatey.org/packages/vscode

Issue with VSC build (CMD-Shift-B) command on mac

I am working through the instructions on building VSC for developers (https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run) currently. Right under "Build" it instructs me to go "Go into vscode and start the build task with CMD+Shift+B) since I have a mac. I have gone into the folder in my finder and have pressed this combination of buttons but nothing happens at all. Am I supposed to do this in the terminal or am I missing anything?
It looks like the vscode directory must be opened in Visual Studio Code and a build is performed with ⌘ Command+Shift+B.
Here is an older version of the instructions where it is clearer:
https://github.com/microsoft/vscode-wiki/blob/2e2d6b0/How-to-Contribute.md#build
It appears that the directory vscode got mixed up with the full application name in a subsequent edit.

How to open Visual Studio Code from the command line on linux?

I know I can use command "code" to open VS code or file, but I don't know what should I do to make it possible after I install VS code in Ubuntu.Thanks.
Launching from the Command Line
You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. We find the best way to do this is to simply type:
code .
Tip: We have instructions for Mac users in our Setup topic that enable you to start VS Code from within a terminal. We add the VS Code executable to the PATH environment variable on Windows and Linux automatically during installation.
Sometimes you will want to open or create a file. If the specified files does not exist, VS Code will create them for you:
code index.html style.css readme.md
Tip: You can have as many file names as you want separated by spaces.
Source: https://code.visualstudio.com/Docs/editor/codebasics
So, there are a couple of solutions for this.
I've linked a video that shows you how to add vscode to $PATH
(which didn't work for me because I couldn't find the "shell:install path" command)
I uninstalled the vscode from my ubuntu and re-installed using sudo snap install --classic code
(This method worked for me)
Tell me which one works for you... and if you have extensions installed to your vscode then i guess you ought to make a backup or something.
Link to the video: https://youtu.be/iP5FKZXtDBs