[.NET 5] add a Run MSBuild target#4609
Merged
jonpryor merged 1 commit intodotnet:masterfrom Apr 24, 2020
Merged
Conversation
Currently with .NET 5, you can build, deploy, and run an app with:
dotnet publish foo.csproj -t:Install -t:StartAndroidActivity
This doesn't match the behavior of other platforms that use `dotnet
run` to launch.
Unfortunately `dotnet run` won't work in its current state:
Unable to run your project.
Ensure you have a runnable project type and ensure 'dotnet run' supports this project.
A runnable project should target a runnable TFM (for instance, netcoreapp2.0) and have OutputType 'Exe'.
The current OutputType is 'Library'.
But we can supply a `Run` target to start Android applications:
https://github.com/dotnet/sdk/blob/645919b8e850771a73f2f7a31b97038d6bdf1092/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L755-L758
This at least allows this command to work:
dotnet publish foo.csproj -t:Run
I updated a test to use this command as well.
pjcollins
approved these changes
Apr 23, 2020
dellis1972
approved these changes
Apr 23, 2020
jonathanpeppers
added a commit
to dotnet/maui-samples
that referenced
this pull request
Apr 29, 2020
* `$(OutputType)` = `Exe` is what flags an app vs library dotnet/android#4604 * New `Run` target dotnet/android#4609
jonathanpeppers
added a commit
to dotnet/maui-samples
that referenced
this pull request
Apr 29, 2020
* `$(OutputType)` = `Exe` is what flags an app vs library dotnet/android#4604 * New `Run` target dotnet/android#4609
jonathanpeppers
added a commit
to dotnet/maui-samples
that referenced
this pull request
Apr 29, 2020
* `$(OutputType)` = `Exe` is what flags an app vs library dotnet/android#4604 * New `Run` target dotnet/android#4609
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently with .NET 5, you can build, deploy, and run an app with:
This doesn't match the behavior of other platforms that use
dotnet runto launch.Unfortunately
dotnet runwon't work in its current state:But we can supply a
Runtarget to start Android applications:https://github.com/dotnet/sdk/blob/645919b8e850771a73f2f7a31b97038d6bdf1092/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L755-L758
This at least allows this command to work:
I updated a test to use this command as well.