Граф коммитов

12 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 16be59f7d6
[dotnet] Show a better error when using a .NET framework version we don't support. (#20142)
If a project tried to use a .NET 6 project (say TargetFramework=net6.0-ios), then
we used to show these rather unhelpful errors:

    error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools-net6
    error NETSDK1147: To install these workloads, run the following command: dotnet workload restore

The underlying problem is that we don't support .NET 6 anymore, so with this fix we now show:

    error NETSDK1202: The workload 'net6.0-ios' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy.

which is much more helpful.

References:

* https://github.com/dotnet/sdk/pull/32426
* https://github.com/xamarin/xamarin-android/pull/8047

Fixes https://github.com/xamarin/xamarin-macios/issues/18790.
2024-02-21 10:07:09 +01:00
Rolf Bjarne Kvinge 3c7c4e7130
[dotnet] Generate the AutoImport.props file for each platform. (#15387)
This reduces some code duplication.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-07-12 10:00:35 +02:00
Rolf Bjarne Kvinge ab88892fd1
[dotnet] Update logic for default global namespaces and fix the templates. Fixes #12457. (#12471)
* Add 'ImplicitUsings=true' to all the templates.
* Make the implicit global namespaces C#-only.
* Add the implicit global namespaces to the 'Using' itemgroup instead of the
  'Import' itemgroup.
* Make sure the global namespaces are set from AutoImport.props, so that the
  user may remove any global namespace they don't want in their project file
  (by doing something like: `<Using Remove="Foundation" />`)

Ref: https://github.com/dotnet/sdk/issues/19521
Ref: https://github.com/dotnet/sdk/issues/19793

Fixes https://github.com/xamarin/xamarin-macios/issues/12457.
2021-08-19 07:47:03 +02:00
Rolf Bjarne Kvinge 9930ddc6dd
[dotnet] Implement a workaround for .NET's lack of extensibility for 'dotnet run'. (#12458)
.NET doesn't support executing other targets/tasks when doing "dotnet run".
However, we need to (like we do for our current "Run" target), so implement a
rather simplistic/hacky workaround by making "dotnet run" just do "dotnet
build /t:Run".

It doesn't support everything that "dotnet run" does (for instance it doesn't
support the /no-build flag), but it should work for most use cases.

Ref: https://github.com/dotnet/sdk/issues/18436
2021-08-17 16:50:37 +02:00
Rolf Bjarne Kvinge c79f1d626c
[dotnet] Add a data/UnixFilePermissions.xml file to the sdk packs. Fixes #11860. (#11869)
NuGet doesn't support preserving the executable bit for files in *.nupkgs
(which are just zip files), so .NET implemented a [temporary
workaround](https://github.com/dotnet/sdk/pull/17299) for workload installs,
where they hardcoded files that should be executable.

This isn't really sustainable, and they'll remove their workaround, so we need
to use their supported method of specifying the file permissions: a
data/UnixFilePermissions.xml file.

Fixes https://github.com/xamarin/xamarin-macios/issues/11860.
2021-06-09 07:54:18 +02:00
Rolf Bjarne Kvinge 8f0ca7508a [dotnet] Reorder imports to account for that our targets are imported earlier in the build process.
In the latest .NET 6, our Workloads.targets is imported earlier in the build. This
requires a few changes, because we still need to run most of our logic later in the
process, which we do by adding targets files we want imported later to the AfterMicrosoftNETSdkTargets
property.

What we're loading as soon as possible:

* Our version information (Xamarin.Shared.Sdk.Versions.targets)
* The supported OS versions (Microsoft.<platform>.Sdk.SupportedTargetPlatforms.targets)
* The default OS version (Xamarin.Shared.Sdk.TargetFrameworkInference.targets).

This is all information that the .NET build require early on.

Changes:

* Rename all files that are loaded early to *.props.
* Updated documentations to reflect these changes.
* Remove Microsoft.<platform>.TargetFrameworkInference.targets, these files aren't
  used and don't contain anything useful.
* Move the logic to calculate _ComputedTargetFrameworkMoniker has been delayed
  to later, because it needs TargetFrameworkMoniker set.
2020-11-10 11:41:30 +01:00
Rolf Bjarne Kvinge e9c61f1053 [dotnet] Make default items file templated to make it platform-specific.
The template takes each platform as input, and adds a TargetPlatformIdentifier condition
to the item groups.

This also means removing Xamarin.Shared.Sdk.DefaultItems.props, and put all the generated
logic into Microsoft.<platform>.Sdk.DefaultItems.props.

We can't use an identical default items file for all four platforms, because the
file is loaded once for each platform, and if the file is identical it means it'll
get repeated four times (and everything included by default will be included four
times, ending up with build errors).
2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge c34d9c092d [dotnet] Merge Microsoft.<platform>.Sdk.props into Microsoft.<platform>.Sdk.targets. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge e43688a60b [dotnet] Merge Xamarin.Shared.Sdk.props into Xamarin.Shared.Sdk.targets. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge 1be152e35b [dotnet] Remove Microsoft.<platform>.Sdk/Sdk/Sdk.props, it's not used anymore. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge 9dec2ec91c [dotnet] Add AutoImport.props. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge 5834572741
Create and publish .NET NuGet packages. (#8576)
Create the various NuGet packages to support .NET 5+. The packages are
currently empty (and not very useful), but the actual content will come later.

The current set of NuGet packages are (this list is duplicated for each
platform: iOS, tvOS, watchOS and macOS):

* Microsoft.iOS.Sdk: currently contains the basic MSBuild targets files for an
  MSBuild Project SDK. Will eventually contain all the build logic. Might also
  eventually contain other tools (mlaunch, bgen, etc.), but these might also
  end up in a different package.
* Microsoft.iOS.Ref: will contain the Xamarin.iOS.dll reference assembly.
* Microsoft.iOS.Runtime.[RID]: will contain architecture-specific files
  (libxamarin*.dylib, the Xamarin.iOS.dll implementation assembly, etc.):

The NuGets built on CI are automatically published to a NuGet feed.

The versioning for the NuGet packages required a few changes: OS bumps are now
changed in Make.versions instead of Make.config (this is explained in the
files themselves as well).
2020-05-13 15:23:29 +02:00