Skip to content

Commit 0b13788

Browse files
[Xamarin.Android.Cecil] fix assembly names if using $(CecilSourceDirectory)
Context: dotnet/android#1747 Downstream in xamarin-android, I started getting a build failure on Windows such as: xamarin-android\external\Java.Interop\src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.targets(23,5): error MSB3375: The file "..\..\bin\Debug\\Xamarin.Android.Cecil.dll" does not exist. xamarin-android\external\Java.Interop\src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.targets(23,5): error MSB3375: The file "..\..\bin\Debug\\Xamarin.Android.Cecil.Mdb.dll" does not exist. Looking in my `external\Java.Interop\bin\Debug` directory, the `Mono.Cecil` assemblies were named `Mono.Cecil.*` instead of `Xamarin.Android.*`. I think this was an oversight, but I don't know how the builds were green... Looking at `Mono.Cecil.csproj` in `xamarin-android/external/mono/external/cecil` there was no way to override `AssemblyName`. But we can use the `<Move />` task instead. To fix this: - Added a `_MonoCecilAssemblies` to check for any files named `Mono.Cecil.*` - `<Move />` the files to start with `Xamarin.Android.*` instead.
1 parent bed2958 commit 0b13788

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Xamarin.Android.Cecil/Xamarin.Android.Cecil.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
Targets="Clean;Build"
2121
StopOnFirstFailure="True"
2222
Properties="Configuration=net_4_0_Debug;OutputPath=$(CecilOutputPath);BuildingSolutionFile=false" />
23+
<ItemGroup>
24+
<_MonoCecilAssemblies Include="$(OutputPath)\Mono.Cecil.*" />
25+
</ItemGroup>
26+
<Move SourceFiles="@(_MonoCecilAssemblies)" DestinationFiles="@(_MonoCecilAssemblies->'%(Identity)'->Replace('Mono.Cecil.', 'Xamarin.Android.Cecil.'))" />
2327
<Touch Files="$(CecilAssemblies)" />
2428
</Target>
2529
<Target Name="Build" DependsOnTargets="BuildCecil" Returns="$(CecilOutputPath)\$(AssemblyName).dll">

0 commit comments

Comments
 (0)