Commit 974cf7d
[Xamarin.Android.Build.Tasks] _ResolveAssemblies better handle missing assemblies (#2622)
Fixes: #2548
Fixes: http://work.devdiv.io/753650
In the case of the Android designer, a `SetupDependenciesForDesigner`
target is run as a way to "build enough" things for the designer to
work.
The problem is if a `<ProjectReference/>` hasn't built yet, the
`_ResolveAssemblies` target can fail:
"HelloForms.Android.csproj" (SetupDependenciesForDesigner target) (1:7) ->
(_ResolveAssemblies target) ->
Xamarin.Android.Common.targets(1898,2): error : Exception while loading assemblies: System.InvalidOperationException: Failed to load assembly HelloForms\bin\Debug\netstandard2.0\HelloForms.dll
Xamarin.Android.Common.targets(1898,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver)
In this case, I ran:
msbuild .\HelloForms\HelloForms.Android\HelloForms.Android.csproj /t:SetupDependenciesForDesigner /p:DesignTimeBuild=true /p:AndroidUseManagedDesignTimeResourceGenerator=false /restore /bl
From a fresh checkout of this sample:
https://github.com/jonathanpeppers/HelloWorld/
To fix this problem, we can add an `Exists` check in the `Condition`
for assemblies passed into the `<ResolveAssemblies/>` MSBuild task. I
don't think this will have any negative consequences, since we are
already doing a check for `Exists ('$(OutDir)$(TargetFileName)')`.
I also setup a new test that emulates what happens with
`SetupDependenciesForDesigner`. This should also help us make sure we
aren't breaking the designer in this repo.
Downstream in monodroid, we should also make sure the designer tests
we have there are using a `<ProjectReference/>`.1 parent 42656af commit 974cf7d
File tree
2 files changed
+51
-2
lines changed- src/Xamarin.Android.Build.Tasks
- Tests/Xamarin.Android.Build.Tests
2 files changed
+51
-2
lines changedLines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1481 | 1481 | | |
1482 | 1482 | | |
1483 | 1483 | | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1484 | 1533 | | |
1485 | 1534 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1920 | 1920 | | |
1921 | 1921 | | |
1922 | 1922 | | |
1923 | | - | |
| 1923 | + | |
1924 | 1924 | | |
1925 | | - | |
| 1925 | + | |
1926 | 1926 | | |
1927 | 1927 | | |
1928 | 1928 | | |
| |||
0 commit comments