TFS command line 'Get' failing - visual-studio

I usually use the VS GUI for TFS and have never had any problem.
I am trying to get the command line working and am running TF from the root of the collection's mapped directory.
When I run TF Get <project name> /noprompt / recursive
I get the error message:
Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
I have run this but the error still exists.
When I run TF workspaces I have an entry for the computer I am on (the TFS source is on a different PC) and the collection path http://<comp name:port>/TFS/<project> which is correct.
Has anyone else been in this situation? The various pages I have found talking about it seem to stop after running the tf workspaces command. Has this always worked for everyone else? Perhaps I am just using it wrong?

You are getting this message because the TF get is being run outside of your workspace directory CD to the directory that contains the workspace that you need to work with first.

The commandline isn't asking for the TFS server uri, but for the ProjectCollection uri, so you need to add some extra information:
{https}://{tfsserver}:{port}/tfs/{collection}
Replace:
{https} make sure you use the right protocol, http or https.
{tfsserver} with the hostname of your tfs server
{port} with the port number (default: 8080 or 443)
{collection} with the project collection name (installation default: DefaultCollection)
The ProjectCollection isn't the same thing as the project, so make sure you're entering the correct values. Easiest place to find the collection name is to open Visual Studio and then the Source Control Explorer. The Uri for the project collection should be the root node. It might be that you're entering the Project name, instead of the ProjectCollection name.
If you're in a folder mapped to TFS, then tf get should figure the CollectionUri by itself.
When you have Visual Studio 2010 and 2012 or 2013 installed side-by-side, make sure you're using the Developer Command Prompt from the correct version of Visual Studio. With the advent of Local Workspaces, the 2010 commandline may not be able to find your mappings, where the 2012 or 2013 commandline will.

I fixed this problem by running tf using the "Visual Studio Command Prompt" (also known as the Developer Command Prompt) instead of running the default command prompt that comes with the operating system.
You can find it in Windows 7 under "Start -> All Programs -> Microsoft Visual Studio -> Visual Studio Tools -> Visual Studio Command Prompt".
You may find more documentation, including instructions for other versions of Windows, by visiting Microsoft's Visual Studio Command Prompt MSDN page.

I got this fixed with:
tf workspaces /collection:http://example:8080
tf workfold
tf get /r .

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.

Publish to AWS Lamba - Failed to find the "build-lambda-zip" utility

I'm currently trying to publish my AWS lambda functions using Visual Studio 2019 community (v4.8.03752) and leveraging the AWS Toolkit for Visual Studio (v1.20.1.0). After right clicking my project and selecting 'Publish to AWS Lambda' I receive the following error:
- Zipping publish folder C:\Users\Matt\source\repos\programName\programName\.\bin\Release\netcoreapp3.1\publish to C:\Users\Matt\AppData\Local\Temp\HelloWorld-CodeUri-Or-ImageUri-637489827969959200.zip
- Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
- Error packaging up project in C:\Users\Matt\source\repos\programName\programName\. for CloudFormation resource HelloWorld: Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
I've been able to deploy this MANY times over previous months, up until Friday 2/12 when I started receiving this error (after a reboot). What's even more strange is that if I uninstall the AWS Toolkit for VS, then reinstall it, I'm able to publish successfully 1 time. With my 2nd attempt, I begin to receive this error again.
Steps I've taken to attempt to resolve:
Repair Visual Studio
Uninstall/Reinstall Visual Studio
Uninstall and reinstall amazon.lambda.tools using dotnet tool install -g Amazon.Lambda.Tools
Uninstall AWS Toolkit for VS, Reinstall toolkit. (This works for first deployment, fails when trying to deploy a 2nd time)
UPDATE:
Per some comments below, it looks like this is being caused by McAfee Real-Time Scanning. In checking the logs during a deployment I noticed a "Virus or threat found" record that points directly to the build-lambda-zip.exe file. To permanently avoid this issue moving forward please follow the steps provided by user2174794 in the comments below.
I'm having the same issue. Just started happening today. It was working within the last 2 weeks.
Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
Running Windows 10, Visual Studio 2019
My solution for now is to use the .NET Core CLI
https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/lambda-cli-publish.html
Specifically, the
dotnet lambda deploy-function
A recent update must have broke the AWS Toolkit For Visual Studio.
I have the same problem, it was because my antivirus detect the executable build-lambda-zip.exe, then delete it.
I restore the executable from my antivirus, or restore dotnet tools with the command :
dotnet tool update -g Amazon.Lambda.Tools
I also faced the same issue,
This is because the "build-lambda-zip.exe" file is getting removed by the McAfee Antivirus.
For the permanent fix, you need to follow the below steps.
Step 1
Go to McAfee Settings >> Quarantined Items
You will find the "build-lambda-zip.exe" file there. Restore it to the original location.
Now If you will try to publish, the error won't get displayed. But again on the next scan, the file will get removed.
Step 2
We need to Exclude this file from getting Scanned and removed. So for that,
Go to McAfee Settings >> Real-Time Scanning and Add the "build-lambda-zip.exe" file in the Excluded files list.
For the file path of "build-lambda-zip.exe" got to
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\ and search for the file name.
Maybe you should try reinstalling the AWS Tool Kit and before you make deployments please turn off your antivirus protection. I was troubbling the same issue and my antivirus(McAfee) was deleting build-lambda-zip.exe file when I did deployment first time.
I'm curious about the state of the extension installation. Can you go to VS's extension directory in Windows explorer C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions and in the search box search for AWSToolkitPackage.dll.
Ideally it should only show one instance of that file. Assuming it finds a single instance right click on the file and select "Open File Location". Now that you are in the root folder of the AWS extension check the Resources folder and see if it contains the file build-lambda-zip.exe.
I know the question is in a windows system, but under a linux system, in my case the following command was needed:
sudo apt-get -y install zip

VS Build Tools 2019 Error in Windows Container

Following this tutorial, if I remove the installPath and use the default MsBuild Visual Studio location, I get the following error.
Error: Visual Studio Build Tools 2019 (2) is already installed
I built a similar container a few weeks back and everything worked, however something appears to have moved and I'm unable to work out what.
Adding the modify parameter to the vs_BuildTools.exe command resolves this issue. Unfortunately it forces an installPath to be included but can be set to the default location.

Using npm from the command line with Visual Studio 2015 Web Project

After installing Visual Studio 2015 I am able to use the new editor features to add dependencies to Node packages and restore etc from within a Web project as per this documentation: http://webtooling.visualstudio.com/package-managers/npm/
Presumably Visual Studio must install node/npm somewhere in order to support these features, however it does not seem to modify my PATH to make these tools available on the command line (or via Visual Studio 2015 Command Prompt).
If I want to perform some npm operations on my project from the command line can I do this without installing node/npm again (which might become out of sync with the version of npm/node that Visual Studio is using) or is there a way to access the node/npm installation Visual Studio is using from the command line?
VS2015 installs node using Joyent's installer. It depends on the system-wide install and it does not have it's own specific or local version.
If you're command line is unable to find node.exe, I would first check your path property in your environment variables and add it if it's missing (it should be C:\Program Files (x86)\nodejs). If you see node's install directory there but still can't access it from the command line, reboot. Sometimes Windows needs to restart before it uses the updated path variable.
Hope that helps.

Source control unable to access database

The associated source control plug-in is not installed or could not be initialized.
Common causes for this error include server unavailability and/or incorrect workspace mappings.
O Temporarily work uncontrolled
o Permanentnly remove source control association bindings
Dear friends,
I have installed git and also the git extension,
I have used the clone repository properly,
The git system is working fine on my system, yet I m getting this error
What is the problem?The mappings?
How to solve it... :(
The OP reports that installing the git plugin for Visual Studio (should be "Visual Studio Tools for Git "), the error message is gone.
The common resolution is often to flush the local cache by completing the following steps:
Delete the contents from the following folders
C:\Users\<>\AppData\Local\Microsoft\Team Foundation
C:\Users\<>\AppData\Local\Microsoft\VisualStudio
C:\Users\<>\AppData\Local\Microsoft\VSCommon
Go to the Visual Studio IDE folder in command prompt and Run the following command "devenv /resetuserdata" from the Visual Studio IDE folder.
Typical location for 64 bit:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Typical location for 32 bit:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
Before following the above step please close all instance of your visual studio.
There should be a Global section in the file, which is where all of the settings for this are located. look for GlobalSection(TeamFoundationVersionControl) and remove that entire section down to EndGlobalSection.
Once you do that, reload the solution and tell it to go back online and your bindings should be working again.

Resources