I'm considering using Visual Studio and Xamarin to build a cross-platform app but I prefer to use Sublime Text as my editor. Currently I can't find any information on 3rd party tool integration with Visual Studio.
Does Visual Studio have any way to build from the command line like Xcode does using the "xcodebuild" utility? Ideally I want to make a shell script which can build as if I pressed the build button in VS and return errors I can parse and display in Sublime Text.
Any suggestions are greatly appreciated.
We've use the command line like the following:
msbuild /p:Configuration="AppStore" /p:Platform="iPhone" /p:IpaPackageDir=bin/iPhone/AppStore /p:BuildIpa=true /target:xxxxxxx.sln
Finding doco for what options are required has taken time via Google. Hope this helps.
I use 'vstool' located at "/Applications/Visual Studio.app/Contents/MacOS/vstool" this way:
vstool build -t:Build -c:"Release|iPhone" "MyProject.sln";
As mentioned in vstool help:
Visual Studio Build Tool
build [options] [build-file]
-p --project:PROJECT Name of the project to build.
-t --target:TARGET Name of the target: Build or Clean.
-c --configuration:CONFIGURATION Name of the solution configuration to build.
-r --runtime:PREFIX Prefix of the Mono runtime to build against.
Supported targets:
Build: build the project (the default target).
Clean: clean the project.
Related
I'm trying to build a job for Xamarin.forms project in mac terminal without UI method. but, not sure which are the tools are mandatory to be installed. Could anyone help here ?
Installed : Dotnet Core 6 version of visual studio SDK
Build need to be fully in terminal(mac-command line)
Need to do without visual studio application
Why not try build the app from the command line using MSBuild and see what errors it gives you. That way, you can find out what's missing and add things until it builds.
I'm using this command to build my apps from Windows (you may need to change a few things on Mac):
"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\msbuild.exe" C:\Projects\MyApp\src\MyApp\MyApp.iOS\MyApp.iOS.csproj /p:Platform=iPhone /p:BuildIpa=true /p:IpaPackageDir=C:\Projects\MyApp\artifacts\App_iOS /p:IpaPackageName=MyApp.ipa /p:ServerAddress=192.168.0.23 /p:ServerUser="Username" /p:ServerPassword=123456SafePassword /p:ContinueOnDisconnected=false /p:Configuration=Release /restore /target:Build /verbosity:Normal
Here's some useful info on Continuous Integration with Xamarin.
How do I build and run a Xamarin.UWP application from the command line? I want it to be so that the app builds and runs the same way as the green run button in the Visual Studio 2019 GUI.
Additional notes:
I've tried opening the Visual Studio Developer Command Prompt and trying the following implementations.
msbuild -t:build "PATH_TO_PROJECT\SimTools.UWP.csproj"
Although when I run the executable that gets generated, it gives me this error:
as well as
Additionally, I've tried doing
msbuild -t:build "PATH_TO_PROJECT\SimTools.UWP.csproj" && msbuild -t:install "PATH_TO_PROJECT\SimTools.UWP.csproj"
And although it builds successfully, it says that there is no target for "install" and I do not know how to add that to the .csproj file as I've asked over at How do I add an "install" target to a Xamarin.UWP .csproj file?.
I am trying to build and launch a Xamarin.Forms UWP application from the command line. Using the developer command prompt for Visual Studio 2019 I run the following command:
msbuild -t:build "project path\SimToools.UWP.csproj" && msbuild -t:install "project path\SimTools.UWP.csproj"
Although once I run this command, the build is completed successfully, then I'm met with this error in the command prompt as shown in the image below:
How do I add an install target in the SimTools.UWP.csproj file for MSBuild?
How do I add an “install” target to a Xamarin.UWP .csproj file?
Derive from above description, you have build the app successfully. But it throw error when install the app. msbuild does not support install the UWP app. And for installing UWP app you may need use WinAppDeployCmd.exe command tool to approach. For more detail please refer Install apps with the WinAppDeployCmd.exe tool document.
I have an old script to create Visual Studio Project Files to build libraries. The syntax is
cd Kernel
cd core
qmake -t vclib
cd ccMigration
qmake -t vclib
cd ..
and so on for all of the different directories.
I understand why we use qmake and vclib, but what I am not sure is what is the use of -t in this line:
qmake -t vclib
Looking at this : http://doc.qt.io/archives/qt-5.5/qmake-platform-notes.html it says:
Creating Visual Studio Project Files This section describes how to
import an existing qmake project into Visual Studio. qmake is able to
take a project file and create a Visual Studio project that contains
all the necessary information required by the development environment.
This is achieved by setting the qmake project template to either vcapp
(for application projects) or vclib (for library projects).
This can also be set using a command line option, for example:
qmake -tp vc
Why do they use -tp and is the old script syntax correct by using -t?
After I run the script it takes about 1/2 seconds and where can I find the project files for Visual Studio?
Finally, When I open the project files how can I build a library using Visual Studio? Can someone point me to a place where I can read some material?
Thank you for all the help!
Edit: I ran the script and it created .vcproj files in the directories that qmake was run. Example: In folder Kernel -> core it created ccCore.vcproj project file. When I open the file in Visual Studio 2017 it wanted me to perform a One-way upgrade that will automatically make functional changes to the project in order to open it. Is this okay?
Xamarin Studio has been replaced for Visual Studio on MacOS. I have a project that builds a DLL using Xamarin iOS. For DevOps (automated release), I want to build the project for release from the command line. I know previously the mdtool was used for this purpose, as seen in this answer but now in visual studio there is no more mdtools binary anymore.
msbuild has replaced mdtool (and xbuild), so all the tasks that once were handled by mdtool are now handled by the cross-platform msbuild and its standard set of cmd-line options.
Release configuration:
Clean a single project in a solution
msbuild /p:SolutionDir=./ /target:Clean /p:Configuration=Release SomeProjectLibrary/SomeProjectLibrary.csproj
Build a single project in a solution
msbuild /p:SolutionDir=./ /target:Build /p:Configuration=Release SomeProjectLibrary/SomeProjectLibrary.csproj
Note: Using Using SolutionDir=./ so these cmds are being run from the root directory of the solution.