Skip to content

[.NET 5] add a Run MSBuild target#4609

Merged
jonpryor merged 1 commit intodotnet:masterfrom
jonathanpeppers:net5-run-target
Apr 24, 2020
Merged

[.NET 5] add a Run MSBuild target#4609
jonpryor merged 1 commit intodotnet:masterfrom
jonathanpeppers:net5-run-target

Conversation

@jonathanpeppers
Copy link
Member

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.

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.
@jonpryor jonpryor merged commit 9dc7559 into dotnet:master Apr 24, 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
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants