How to build and run Xamarin.UWP application from command line? - 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?.

Related

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.

How to make VS 2017 run some custom code after any project is loaded? [duplicate]

I am interested to run dotnet watch test when opening a solution with my unit tests in visual studio 2017. Is there a way to run that just after the solution is open without doing it manually?
Visual Studio Task Runner can run any arbitrary CMD command when a project/solution is opened.
Prerequisites: Command Task Runner extention.
Add Foo.cmd with a target command to your project having dotnet watch package installed. It could have one line of code:
dotnet watch run
Make sure the file is properly encoded to UTF-8 without BOM.
After Command Task Runner extention install, Add to Task Runner option should be accessible from context menu of *.cmd files. Press it and choose per-project level. As a result, commands.json should appear in the project.
Go to VS View -> Other Windows -> Task Runner Explorer. Set up the binding for the Foo command in the context menu: Bindings -> Project Open (the window refresh could help to see a recently added command).
Re-open the solution and check a command execution result in Task Runner Explorer.
How it could look:

Visual Studio Mac, build from command line?

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.

Obtain visual studio generated build command

I want to create a batch file for building releases of a multi-solution software. What I am curious about how may I obtain the exact MSBuild command that Visual Studio executes when I click on "Rebuild Solution"?
It is equivalent to
MsBuild /t:Rebuild /p:Configuration=<config>;Platform=<platform>
although VS actually generates a temporary msbuild file from the solution and then builds that. You get the file by setting an MSBuildEmitSolution environment variable:
open a VS command window
enter set MSBuildEmitSolution=1
enter devenv to open a VS instance within that command window so it uses the MSBuildEmitSolution environment variable
open and build your solution

Under vs10 msbuild.exe how can a specific project within a solution.sln be Ignored?

Under vs10 msbuild.exe how can a specific project within a solution.sln be Ignored?
I am building a large project that is moving to Visual Studio 10.0. In the IDE I can uncheck a project within the configuration manager and it will not build it. I need to mimic that behavior with a command line call to msbuild.exe.
The project I want to bypass is an *.dll plugin with a link error. I am stuck on stupid with the link error at the moment and since it stands alone, I can run the main program with out it and just live with a warning at run time that it isn't present.
I need some switch magic concerning calls to msbuild.exe.
If you have a certain configuration in the sln (configured in VS Configuration Manager) that you want to build with MSBuild, you can do so with the following command line:
msbuild /p:Configuration=MyConfiguration MySolution.sln

Resources