Commit d7aa030
committed
[build] Allow Assembly "vendorization"
Context: ff73f92
Context: 061bcc2
Context: https://github.com/xamarin/XamarinVS/pull/12550
Changing `$(Version)` with every commit is fun and all, but doesn't
solve all problems. Commit ff73f92 works "nicely" for MSBuild tasks
via [`<UsingTask/>`][0]. It doesn't work as well for "normal"
assembly references in a "normal" AppDomain context, because
assemblies are [normally resolved][1] via "assembly base name", *not*
the full path name including directory.
Thus, given `Example.dll`:
csc /out:Example.dll /r:Path/To/Xamarin.Android.Tools.AndroidSdk.dll
then when `Example.dll` is loaded, it will try to load
`Xamarin.Android.Tools.AndroidSdk` via a `Load-by-name` method, and
will load the first `Xamarin.Android.Tools.AndroidSdk.dll` loaded
into the `AppDomain`/`AssemblyLoadContext`, regardless of version.
There may not be a good way to control what that assembly *is*.
This causes grief with our peer IDE teams, as assembly versions are
still checked, but on mismatch an exception is thrown (!).
Commit 061bcc2 was an attempt to address this, but proved to be
incomplete.
Attempt to improve matters by introducing a "vendorization" protocol:
1. Update `Directory.Build.props` to import
"parent directory.override.props", so that a "parent checkout"
can easily override MSBuild properties.
2. Update the `*.csproj` files so that `$(AssemblyName)` is forced
to start with `$(VendorPrefix)`, and end with `$(VendorSuffix)`.
This allows a parent checkout to set the `$(VendorPrefix)` and
`$(VendorSuffix)` properties, which will impact the assembly filenames
of all assemblies built in xamarin-android-tools.
[0]: https://docs.microsoft.com/en-us/visualstudio/msbuild/usingtask-element-msbuild?view=vs-2019
[1]: https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/loading-managed1 parent 061bcc2 commit d7aa030
File tree
3 files changed
+11
-1
lines changed- src
- Microsoft.Android.Build.BaseTasks
- Xamarin.Android.Tools.AndroidSdk
3 files changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
7 | 15 | | |
8 | 16 | | |
9 | 17 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
0 commit comments