Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Context: https://docs.microsoft.com/dotnet/core/compatibility/sdk/6.0/write-reference-assemblies-to-obj
Context: dotnet/msbuild#7355

Using the latest internal builds of Visual Studio, you hit the build
error when building xamarin-android:

build-tools\create-packs\Directory.Build.targets(28,5): error MSB4018: The "CreateFrameworkListFile" task failed unexpectedly. [build-tools\create-packs\Microsoft.Android.Ref.proj]
build-tools\create-packs\Directory.Build.targets(28,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path 'external\Java.Interop\bin\Debug-net6.0\ref\Java.Interop.dll'.

This was a breaking change in MSBuild:

Old behavior
Since reference assemblies were added, the .NET SDK has written
reference assemblies to the ref directory in the OutDir directory of
the compilation.

New behavior
Now, reference assemblies are written to the refint directory of the
IntermediateOutputPath directory by default, like many other
intermediate artifacts.

Reason for change
Reference assemblies are generally not run-time assets, and so don't
belong in the OutDir directory by default.

Since we are using the reference assembly as build output, I think
we should put the file in bin.

Let's set $(ProduceReferenceAssemblyInOutDir) to get the old behavior.

After this change goes in, we'll need other changes in
xamarin-android. We might also be able to use $(TargetRefPath) in
some way, but that isn't needed here.

Context: https://docs.microsoft.com/dotnet/core/compatibility/sdk/6.0/write-reference-assemblies-to-obj
Context: dotnet/msbuild#7355

Using the latest internal builds of Visual Studio, you hit the build
error when building xamarin-android:

    build-tools\create-packs\Directory.Build.targets(28,5): error MSB4018: The "CreateFrameworkListFile" task failed unexpectedly. [build-tools\create-packs\Microsoft.Android.Ref.proj]
    build-tools\create-packs\Directory.Build.targets(28,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path 'external\Java.Interop\bin\Debug-net6.0\ref\Java.Interop.dll'.

This was a breaking change in MSBuild:

> Old behavior
> Since reference assemblies were added, the .NET SDK has written
> reference assemblies to the ref directory in the OutDir directory of
> the compilation.

> New behavior
> Now, reference assemblies are written to the refint directory of the
> IntermediateOutputPath directory by default, like many other
> intermediate artifacts.

> Reason for change
> Reference assemblies are generally not run-time assets, and so don't
> belong in the OutDir directory by default.

Since we *are* using the reference assembly as build output, I think
we *should* put the file in `bin`.

Let's set `$(ProduceReferenceAssemblyInOutDir)` to get the old behavior.

After this change goes in, we'll need other changes in
xamarin-android. We might also be able to use `$(TargetRefPath)` in
some way, but that isn't needed here.
@jonpryor jonpryor merged commit 7dc270d into dotnet:main Feb 8, 2022
@jonathanpeppers jonathanpeppers deleted the ProduceReferenceAssemblyInOutDir branch February 8, 2022 17:39
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Feb 14, 2022
Context: https://docs.microsoft.com/dotnet/core/compatibility/sdk/6.0/write-reference-assemblies-to-obj
Context: dotnet/msbuild#7355
Context: dotnet/java-interop#949

Using the latest internal builds of Visual Studio, you hit the build
error when building xamarin-android:

    error MSB4018: The "CreateFrameworkListFile" task failed unexpectedly. [C:\src\xamarin-android\build-tools\create-packs\Microsoft.Android.Ref.proj] [C:\src\xamarin-android\build-tools\create-packs\Microsoft.Android.Sdk.proj]
    error MSB4018: System.IO.FileNotFoundException: Could not find file 'C:\src\xamarin-android\bin\Release\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\net6.0-android32\ref\Mono.Android.dll'.

This was a breaking change in MSBuild:

> ### Old behavior
> Since reference assemblies were added, the .NET SDK has written
> reference assemblies to the `ref` directory in the `OutDir`
> directory of the compilation.
>
> ### New behavior
> Now, reference assemblies are written to the `refint` directory of
> the `IntermediateOutputPath` directory by default, like many other
> intermediate artifacts.
>
> ### Reason for change
> Reference assemblies are generally not run-time assets, and so don't
> belong in the `OutDir` directory by default.

Since we *are* using the reference assembly as build output, I think
we *should* put the file in `bin`.

Let's set `$(ProduceReferenceAssemblyInOutDir)`=True to get the
old behavior.

I could not figure out how to use `$(TargetRefPath)` here, as
different projects are using the files than producing them... If the
same project was building `Mono.Android.dll` as packing it, we could
use that property and not have to know if the file is in `bin` or `obj`.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 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.

2 participants