Skip to content

Conversation

pjcollins
Copy link
Member

@pjcollins pjcollins commented Oct 7, 2020

Context: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workloads.md

In One .NET, our legacy installer payload content will be distributed
through a new "Optional Workload" concept. Early support for workloads
has now landed in VS and the .NET SDK, and we'd like to begin to convert
our monolithic MSBuild SDK NuGet into various workload packs. In an
effort to support dev and test efforts to this end, it will be helpful
to introduce a non-system installation of .NET that we can modify freely
without admin access or fear of leaving machines in a broken state.

@pjcollins pjcollins force-pushed the local-dotnet branch 3 times, most recently from 9b75680 to 8717b68 Compare October 7, 2020 18:19
@pjcollins
Copy link
Member Author

@pjcollins pjcollins force-pushed the local-dotnet branch 2 times, most recently from cb2e582 to ee085ca Compare October 7, 2020 23:46
@jpobst
Copy link
Contributor

jpobst commented Oct 8, 2020

Shouldn't we be moving towards a future where xaprepare is built and run by .NET Core instead of .NET Framework/Mono? How is this going to affect that?

@pjcollins
Copy link
Member Author

pjcollins commented Oct 8, 2020

@jpobst The goal of these changes is to provide a non-system based installation of the .NET SDK that we can use for One .NET work, and modify freely (without requiring admin) for local dev and local + CI test needs without worrying about breaking system installations. It also allows us to consolidate our .NET SDK version dependency information into a single location.

Building xamarin-android still requires a system installation of .NET even with these changes (unless you update your $PATH to prefer this installation). In the future if we do move xaprepare to target net5 or something newer, we'll likely want to consider introducing some system installation bootstrap for .NET. I don't think we'll want or need to do this in the short or even mid term future though.

@pjcollins pjcollins marked this pull request as ready for review October 8, 2020 16:41
@jpobst
Copy link
Contributor

jpobst commented Oct 8, 2020

It feels like we should keep the .NET Core 3.1 install the way it is today, and then install any additional needed .NETs with the new stuff. I think there's no reason we couldn't be running xaprepare with .NET Core today, other than no one has made the change.

@pjcollins
Copy link
Member Author

It feels like we should keep the .NET Core 3.1 install the way it is today, and then install any additional needed .NETs with the new stuff.

I see some downside with this approach. We'd be increasing the number of places where we are tracking .NET SDK dependency information, and we'd have to keep the 3.1 version in sync across multiple YAML files (including monodroid which is already out of sync, but we don't do a great job of syncing there in general). I'd also prefer to keep the .NET SDK versions we depend on for CI/testing in the same installation directory for my own sanity. Maybe there are benefits that outweigh these costs that I am overlooking?

I know @grendello was opposed to making this a .NET Core app when this was being written, I assume some of that reasoning still stands today? This tool seems like one of the lower priority things we'd want/need to upgrade to .NET Core when it comes to our build system,

@jpobst
Copy link
Contributor

jpobst commented Oct 8, 2020

I think there are some benefits:

@grendello
Copy link
Contributor

I think there are some benefits:

* Mono and .NET Framework are deprecated, we should be working towards using them less.  It'll be a very long process, but we shouldn't be going backwards.

* The same command runs on all platforms, so we don't need the extra complexity of `xaprepare.exe` versus `mono xaprepare.exe`.

* We could avoid the hacks in place so that `xaprepare` can update the system Mono while it is running on Mono.  (https://github.com/xamarin/xamarin-android/blob/master/build-tools/automation/azure-pipelines.yaml#L164-L167)

One big disadvantage of this is that we would require both Mono and DotNet to be installed on the system with no, currently, clear advantage to using dotnet. xaprepare.exe is invoked via make on *nix so there's no benefit here either (on Windows it's invoked via MSBuild with /t:Prepare)

@grendello
Copy link
Contributor

It feels like we should keep the .NET Core 3.1 install the way it is today, and then install any additional needed .NETs with the new stuff.

I see some downside with this approach. We'd be increasing the number of places where we are tracking .NET SDK dependency information, and we'd have to keep the 3.1 version in sync across multiple YAML files (including monodroid which is already out of sync, but we don't do a great job of syncing there in general). I'd also prefer to keep the .NET SDK versions we depend on for CI/testing in the same installation directory for my own sanity. Maybe there are benefits that outweigh these costs that I am overlooking?

I know @grendello was opposed to making this a .NET Core app when this was being written, I assume some of that reasoning still stands today? This tool seems like one of the lower priority things we'd want/need to upgrade to .NET Core when it comes to our build system,

Indeed. I'd much prefer to convert xaprepare to .net core only after we absolutely require dotnet to be installed.

@jpobst
Copy link
Contributor

jpobst commented Oct 8, 2020

There will never be a "big bang" change where we convert 100% to dotnet in a single commit. The only way to do it is slowly when the opportunities arise. Putting it off is simply fighting against the inevitable future.

@jpobst
Copy link
Contributor

jpobst commented Oct 8, 2020

One big disadvantage of this is that we would require both Mono and DotNet to be installed on the system with no, currently, clear advantage to using dotnet. xaprepare.exe is invoked via make on *nix so there's no benefit here either (on Windows it's invoked via MSBuild with /t:Prepare)

We do require both Mono and DotNet to be installed on the system. This is simply about which is used to bootstrap setting them up.

@grendello
Copy link
Contributor

There will never be a "big bang" change where we convert 100% to dotnet in a single commit. The only way to do it is slowly when the opportunities arise. Putting it off is simply fighting against the inevitable future.

I just don't see any compelling advantage from this change with regards to xaprepare as of yet

@pjcollins pjcollins changed the title [ci] Move .NET SDK installation to xaprepare [ci] Move .NET preview installation to xaprepare Oct 8, 2020
@pjcollins pjcollins requested a review from grendello October 8, 2020 22:01
pjcollins and others added 2 commits October 8, 2020 20:28
@jonpryor
Copy link
Contributor

jonpryor commented Oct 9, 2020

Context: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workloads.md

For .NET 6, our .NET 6 installer payload content will be distributed
through a new "Optional Workload" concept.

Early support for workloads has now landed in VS and the .NET SDK,
and we'd like to begin to convert our monolithic MSBuild SDK NuGet into
various workload packs.  In an effort to support dev and test efforts
to this end, it will be helpful to introduce a non-system installation
of .NET that we can modify freely without admin access or fear of
leaving machines in a broken state.

Update the `xaprepare -s:Standard` scenario to install multiple
`dotnet` versinos into `$(DotNetPreviewPath)`, which defaults to
`$(AndroidToolchainDirectory)\dotnet`.

The currently installed `dotnet` versions are:

  * 3.1.3: Stable version, for some tests.
  * 5.0.100-rc.2.20480.7: Preview .NET 5 RC which contains support
    for the Optional Workload concept.

@jonpryor jonpryor merged commit cdc35b6 into dotnet:master Oct 9, 2020
@pjcollins pjcollins deleted the local-dotnet branch October 9, 2020 14:52
pjcollins added a commit to pjcollins/android that referenced this pull request Nov 16, 2020
Context: dotnet#5293

PR dotnet#5293 introduced an incompatibility with xabuild, and it appears to
be causing issues with other stable builds.  The [UseDotNet][1] task has
a caching feature to improve "installation" times for certain versions,
however this can cause issues for our non-hosted build machines.

We should continue to use the custom `use-dot-net` task that Jonathan
Peppers added for us during earlier .NET 5 preview work.  This template
was removed in PR dotnet#5191 but in hindsight it should not have been.

[1]: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops
pjcollins added a commit to pjcollins/android that referenced this pull request Nov 16, 2020
Context: dotnet#5293

PR dotnet#5293 introduced an incompatibility with xabuild, and it appears to
be causing issues with other stable builds.  The [UseDotNet][1] task has
a caching feature to improve "installation" times for certain versions,
however this can cause issues for our non-hosted build machines.

We should continue to use the custom `use-dot-net` task that Jonathan
Peppers added for us during earlier .NET 5 preview work.  This template
was removed in PR dotnet#5191 but in hindsight it should not have been.

[1]: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops
pjcollins added a commit to pjcollins/android that referenced this pull request Nov 16, 2020
Context: dotnet#5293

PR dotnet#5293 introduced an incompatibility with xabuild, and it appears to
be causing issues with other stable builds.  The [UseDotNet][1] task has
a caching feature to improve "installation" times for certain versions,
however this can cause issues for our non-hosted build machines.

    /Users/builder/azdo/_work/_tool/dotnet/sdk/5.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(54,5): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')". Method '[MSBuild]::GetTargetFrameworkIdentifier' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order. [/Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj]

We should continue to use the custom `use-dot-net` task that Jonathan
Peppers added for us during earlier .NET 5 preview work.  This template
was removed in PR dotnet#5191 but in hindsight it should not have been.

[1]: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops
jonathanpeppers pushed a commit that referenced this pull request Nov 16, 2020
Context: #5293

PR #5293 introduced an incompatibility with `xabuild`, and it appears to
be causing issues with other stable builds.  The [UseDotNet][1] task has
a caching feature to improve "installation" times for certain versions,
however this can cause issues for our non-hosted build machines.

    /Users/builder/azdo/_work/_tool/dotnet/sdk/5.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(54,5): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')". Method '[MSBuild]::GetTargetFrameworkIdentifier' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order. 

We should continue to use the custom `use-dot-net` task that 
@jonathanpeppers added for us during earlier .NET 5 preview work.  This template
was removed in PR #5191 but in hindsight it should not have been.

[1]: https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer
@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.

6 participants