Is your feature request related to a problem? Please describe.
In .NET 7, the ability to pass MSBuild properties was added to dotnet run.
Unfortunately, this does not work for .NET MAUI projects, as we actually need an MSBuild target to run in order to deploy and launch an application on a mobile device.
To get an idea of our implementation currently:
https://github.com/xamarin/xamarin-android/blob/0e4c29aabb2af023d3ff66f02d42c2b487575d85/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Application.targets#L15-L16
We set $(RunCommand) and $(RunArguments) to launch a new process that runs dotnet build -t:Run. At this point we don't know what MSBuild properties were passed to dotnet run, so we don't have a way to pass them along.
Describe the solution you'd like
If optional workloads could opt into a new setting like $(UseTargetForRun) (or choose a better name), it feels like the dotnet CLI should be able to invoke a Run target directly instead of using $(RunCommand) and $(RunArguments).
This would allow the MSBuild properties to pass through, and we aren't starting an unnecessary dotnet process.
Additional context
This is important for CLI scenarios for .NET MAUI.
Is your feature request related to a problem? Please describe.
In .NET 7, the ability to pass MSBuild properties was added to
dotnet run.Unfortunately, this does not work for .NET MAUI projects, as we actually need an MSBuild target to run in order to deploy and launch an application on a mobile device.
To get an idea of our implementation currently:
https://github.com/xamarin/xamarin-android/blob/0e4c29aabb2af023d3ff66f02d42c2b487575d85/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Application.targets#L15-L16
We set
$(RunCommand)and$(RunArguments)to launch a new process that runsdotnet build -t:Run. At this point we don't know what MSBuild properties were passed todotnet run, so we don't have a way to pass them along.Describe the solution you'd like
If optional workloads could opt into a new setting like
$(UseTargetForRun)(or choose a better name), it feels like the dotnet CLI should be able to invoke aRuntarget directly instead of using$(RunCommand)and$(RunArguments).This would allow the MSBuild properties to pass through, and we aren't starting an unnecessary
dotnetprocess.Additional context
This is important for CLI scenarios for .NET MAUI.