Visual Studio alternative of command "code ." - visual-studio

We've all seen this command sequence:
git clone [someRepo]
cd [someRepo]
code .
This will clone some repo, get into the folder and open it using Visual Studio Code. Without going into arguments whether VSCode or VS is better - I do use Visual Studio. Is there some VS command that is similar to "code .", that will open some solution directly from git bash/powershell/cmd?
Thanks in advance!

As an improvement of my first question you can use :
git clone [someRepo]
cd [someRepo]
start devenv .
It will open visual studio with the current directory.

Related

Visual Studio 2022: System.InvalidOperationException: "git" is not present in PATH

I'm trying to compile the following project:
https://github.com/xoofx/markdig
In Visual Studio 2022, How to resolve the error message:
System.InvalidOperationException: "git" is not present in PATH.
What's the correctly way to install 'git' for visual studio? I thought Visual Studio Already has git installed out of the box, judging by the label "Git" on the menu bar.
Here's a picture of my screen:
Menu: Tools->Command-Line:
Thanks for adding the picture. You need to have git installed. This can be done independently or through visual studio installer.
https://git-scm.com/downloads
It will ask you during installation if you want it to be added to the path - choose yes.
Once you have installed, launch the command window from start menu
and run git command. That should show something like this -
[2]
Once you have git command running from command line it should work from visual studio as well. Essentially VS is trying to launch that command from its shell and failing to find it because you dont have git installed.
VS does come with git installed but you have to choose it in its workloads. You have to go through all available installation options. See the screenshot below from VS 2017 installation workload. You can do this by re-launching your VS installer and selecting the products that you want installed. Since I use most of the things, I dont uncheck anything but that takes close to 50Gig space on the disk - something you want to be aware of.

run visual studio from terminal

I use Bash terminal on Windows. And I confused how can I run the Visual Studio solution from terminal?
For example
open the terminal
git clone https://github.com/somerepository.git
cd somerepository
*VISUAL-STUDIO* somerepository.sln
Just only.
What can I write instead of VISUAL-STUDIO
UPD.
I use "Git For Windows", its provides a BASH emulation.

Leptonica on Windows + Visual Studio

I have followed the following steps for installing Leptonica on Windows with Visual Studio
3. Building on Windows
(a) Building with Visual Studio
1. Download the latest SW
(Software Network https://software-network.org/)
client from https://software-network.org/client/
2. Unpack it, add to PATH.
3. Run once to perform cmake integration:
sw setup
4. Run:
git clone [https://github.com/danbloomberg/leptonica](https://github.com/danbloomberg/leptonica)
cd leptonica
mkdir build
cd build
cmake ..
5. Build a solution (leptonica.sin) in your Visual Studio version.
I did everything except for step 5.
My build directory now looks as follows:
ALL_BUILD.vcxproj LeptonicaConfig.cmake
ALL_BUILD.vcxproj.filters LeptonicaConfig-version.cmake
cmake_install.cmake LeptonicaTargets.cmake
cmake_uninstall.cmake src/
CMakeCache.txt sw_build_dependencies.vcxproj
CMakeFiles/ sw_build_dependencies.vcxproj.filters
config_auto.h.in uninstall.vcxproj
INSTALL.vcxproj uninstall.vcxproj.filters
INSTALL.vcxproj.filters x64/
lept.pc ZERO_CHECK.vcxproj
leptonica.sln ZERO_CHECK.vcxproj.filters
I cannot seem to find leptonica.sin and how to integrate with visual studio ? I need the steps that are left. I am new to visual studio please mind my question.
I have Visual Studio 2019
You probably already figured this out (I'd hope) but if not... Step #5 as you listed has a typo:
Build a solution (leptonica.sin) in your Visual Studio version.
It's supposed to be leptonica.sLn, as in a Visual Studio Solution file.
In your build directory listing you have leptonic.sln. If you double-click that it should open in Visual Studio (assuming a default/correct install).
With Visual Studio 2019 at least you don't actually have to generate a solution file with CMake manually like this as Visual Studio now supports opening folders that contain CMakeLists.txt files as though they are solutions.
You can just do the following to build Leptonica on Windows:
Download sw-master-windows-client.zip from https://software-network.org/client/.
Unzip sw.exe to some directory sw_dir.
Add sw_dir to your path environment variable. Log out and log in to make sure the path is updated.
Enter power shell etc. and run "sw setup" from a command line.
Git clone Leptonica to some directory from https://github.com/danbloomberg/leptonica
Start up Visual Studio.
Choose "Open local folder" from the intitial dialog VS presents you with. Select the Leptonica folder.
At this point Visual Studio will begin running CMake on the folder and it should succeed assuming it can find sw.exe. This step takes a while. After it completes you can build all from the build toplevel menu.

File compare on macOS with FreeFileSync and Visual Studio Code

I struggling to make it work for me.
I have FreeFileSync (v10.20) and Visual Studio Code (v1.43.0) installed on macOS Mojave (v10.14.6) and would like to add a file compare context menu command, so
Step 1:
I added Visual Studio Code to my path as explained on their site (https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line):
Launch VS Code
Open the Command Palette (F1) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
After this, I am able to launch Terminal and run:
code --diff
Step 2:
I added the following option to FreeFileSync Preferences at 'Customize context menu':
Description: Compare with Visual Studio Code
Command line: code --diff "%local_path%" "%local_path2%"
The issue:
So far, it does nothing. No errors. No windows opened. Why?
Thanks for your help in advance!
Craby
OK, just I found out the solution myself, I hope this will help you guys, too:
The solution is to configure Visual Studio Code as external file compare (diff) tool in FreeFileSync as follows:
Description: Compare with Visual Studio Code
Command line: /Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron --diff "%local_path%" "%local_path2%"
Note the \ backslashes to escape the spaces... without these it fails silently.
Enjoy!
Craby

Visual Studio Code "Git not found"

I have Windows10 with the Ubuntu bash and Visual Studio Code.
Every time I start Visual Studio Code it prompts a warning saying:
Git not found. Install it or configure it using the 'git.path' setting
I got git actually installed through the bash terminal:
# which git
/usr/bin/git
How can I instruct Visual Studio Code to use that git installed in the bash terminal?
I have tried through the git.path setting but I am not sure how to set the path to something that is relative to the bash terminal.
If you're running Visual Studio Code on Windows, you also need to install Git for Windows. VsCode currently can't access git on the linux subsystems.

Resources