How do I update Visual Studio for Mac / Xamarin Studio from a terminal? - ios

I run some mac build agents linked to TFS / DevOps Server. From time to time Visual Studio / Xamarin Studio gets some updates, I want to update Visual Studio via SSH or on via a local Terminal.
On windows I found an UI and Terminal (Command Line) approve:
https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2017
I can do something like this on command line for Windows:
vs_enterprise.exe update --quiet
I found that How-To (which is UI-driven) for a Mac. This steps I do at the moment for every update on each build agent:
https://learn.microsoft.com/en-us/visualstudio/mac/update
I found that here on StackOverflow:
How to install Visual Studio for Mac from Terminal (Mac OS)
How can I update Visual Studio for Mac / Xamarin Studio from the Terminal? Is there a similar command-line tool like "vs_enterprise.exe update --quiet" from the windows world for macs?

Doesn't seem like there is anything built into Visual Studio to let you update from command line.
There is vstool in /Applications/Visual Studio.app/Contents/MacOS which seems to let you update add-ins from command line. But nothing that seems to update Visual Studio itself.
You could perhaps use a third party tool such as homebrew and let that update Visual Studio for you.
Install VS:
brew cask install visual-studio
Update casks later:
brew cask upgrade
Not sure if that helps you much though.

Related

CMake - could not find any instance of 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.

"System cannot find the file specified" when adding a new Azure IoT Edge module in Visual Studio

I've followed these steps exactly and am getting the error below:
Select File > New > Project...
In the new project window, search for IoT Edge and choose the Azure IoT Edge (Windows amd64) project. Click Next.
In the configure your new project window, rename the project and solution to something descriptive like CSharpTutorialApp. Click Create to create the project.
In the Add Module window, configure your project with the following values:
Select Add to create the module.
I get this error regardless of the combination of solution folders, module names, and any other parameters that I enter during this workflow:
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
The net result is that no changes are made to the solution -- no IoT Edge module project is created, no other files are altered.
I've tried running Visual Studio 2019 (16.4.3) as administrator, uninstalling and reinstalling the Azure IoT Edge Tools extension, all without success.
What can I do to troubleshoot this further?
Update 1: I've double-checked all documented prerequisites and still have this issue.
Visual Studio 2019 16.4.3, all prerequisite Visual Studio workloads installed
.NET Core workload installed the latest -- 3.1 LTS SDK -- only. Is there a hidden dependency on a specific older .NET Core 2.x SDK somewhere? Or is the documentation for VS Code on the subject out of date? (I'm using VS but was looking everywhere to see if I had missed anything)
Git for Windows installed (via Visual Studio Installer)
Docker Windows Desktop installed & switched to Windows containers
Azure IoT Edge Tools for VS 2019 installed (and uninstalled & reinstalled)
no UNC/FQ paths in the item or project template locations:
C:\Users\larsk\OneDrive\Documents\Visual Studio 2019\Templates\ProjectTemplates
C:\Users\larsk\OneDrive\Documents\Visual Studio 2019\Templates\ItemTemplates
multiple reboots
this is on a machine that just recently got the latest (1909) version of Win10 Pro reinstalled on it.
Update 2: Updating to Visual Studio 2019 16.4.4 did not help either.
The solution turned out to be running a Repair operation through the Visual Studio Installer.

Cake.AppCenter: Could not locate executable

Using iOS operating system.
While trying to publish the APK in MAC machine via Jenkins I am facing the below error,
Error: One or more errors occurred. (AppCenter: Could not locate
executable.)
AppCenter: Could not locate executable.
I am facing this issue after upgrading my Visual Studio 2017 to Visual Studio 2019 with mono version 5.10.1 to 5.18.1. Its working fine in previously with Visual Studio 2017 and 5.10.1 mono version. The issue is reproduced only after upgrading the Visual Studio and mono version.
Note: While I have to publish the APK manually from my machine its working fine. But when I try to publish via Jenkins, facing this error. The issue can be reproduced only by calling the publish task (in cake file) from Jenkins.
Could you please suggest a solution for this?
AppCenterDistributeRelease(new AppCenterDistributeReleaseSettings
{
File =$"../Myapp.UWP/AppPackages/AppPackages_{revisionName}.app.zip",
Token = apiToken,
Group = "Collaborators",
ReleaseNotesFile = "../cireports/releasenotes/releasenotes.txt",
App = "My-Team/Myapp-Windows"
});
You need the AppCenter CLI installed which is what the Cake.AppCenter addin orchestrates.
It's a node tool installable using npm
npm install -g appcenter-cli
Once installed, the appcenter command will be globally available.

Cant find package manager console in visual studio for mac

I am using Visual studio for mac. I need to install some packages but I can't find package manager console for that.
Visual studio version: Preview 1 (7.0 build 347)
Warning:
A commenter reports this extension crashes VS Community 2019 for Mac version 8.5 (Build 3183). I haven't upgraded to it, so I can't speak to this. Anyone with information/fix/alternate approach, please chime in down in the comments.
OK:
At least in Visual Studio Community 8.4.8 build 2, you can find it under Visual Studio-->Extensions, using search term "nuget":
It took me so long to find this I hope it helps someone else find it faster!
Similar to Xamarin Studio, you have to use its dialog,
https://developer.xamarin.com/guides/cross-platform/xamarin-studio/nuget_walkthrough/
As there was no cross platform PowerShell, Xamarin Studio lacks of Package Manager Console. It might come one day in Visual Studio for Mac. We will see.
You can follow the NuGet CLI reference and install it
https://learn.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference
An excerpt from that link provided reads:
macOS/Linux
Behaviors may vary slightly by OS distribution.
Install Mono 4.4.2 or later.
Execute the following commands at a shell prompt:
# Download the latest stable `nuget.exe` to `/usr/local/bin`
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
# Give the file permissions to execute
sudo chmod 755 /usr/local/bin/nuget.exe
Create an alias by adding the following script to the appropriate file for your OS (typically ~/.bash_aliases or ~/.bash_profile):
# Create as alias for nuget
alias nuget="mono /usr/local/bin/nuget.exe"
Reload the shell. Test the installation by entering nuget with no parameters. NuGet CLI help should display.
I found a good reference for mac users:
https://github.com/mrward/monodevelop-nuget-extensions
Thanks for the reference and it works for me.

Web.config fail to transform on TFS 2012

I currently work on a MVC 4.0 project that was upgraded to MVC 5.0 using the official guide.
I use Visual Studio 2012 locally and a publish profile was created for the project.
Locally I call msbuild via the Visual Studio developer command prompt using: msbuild /m /p:Configuration=Dev;DeployOnBuild=true;PublishProfile=Dev my-solution.sln
All projects in the solutions do have a Dev configuration and there is a web.dev.config.
The command line on the server is the same.
So far the difference is that on the server only the visual studio shell is installed (not the full) and we cannot install the full instance of VS2012 on the server.
Also, seeing on the install of TFS on the server, I discovered that only v9.0 target files were installed (Visual Studio 2008). Copying Visual Studio 2012 target files do not fix this problem.
I see 2 solutions so far but searching for a third.
Install full Visual Studio 2012 instance
Update csproj to include a target transformConfigFiles (basically copy and paste the content of the "Microsoft.Web.Publishing.targets" section) or import the file via a declaration inside of the .csproj
Would there be a third solution available?
It is pretty common to install full Visual Studio on your build server. As of VS 2012 you couldn't even run Unit Tests in your build without VS installed.
I'd suggest installing VS and seeing if that fixes the issue.

Resources