Skip to content

Unable to disable Javadoc (XML) generation during dotnet pack because of property reassignment #7762

Description

@awattar

Android application type

Android for .NET (net6.0-android31.0)

Affected platform version

VSMac 17.4.4

Description

dotnet pack command is overriding DocumentationFile - Property reassignment: $(DocumentationFile)="SomeFile.xml" (previous value: "") at /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.485/tools/Xamarin.Android.Bindings.Core.targets (27,5)

  <PropertyGroup Condition=" '$(_UseLegacyJavadocImport)' != 'true' ">
    <DocumentationFile Condition=" '$(DocumentationFile)' == '' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' ">$(OutputPath)$(AssemblyName).xml</DocumentationFile>
    <NoWarn Condition=" '$(DocumentationFile)' != '' ">$(NoWarn);CS1573;CS1591</NoWarn>
  </PropertyGroup>

https://github.com/xamarin/xamarin-android/blame/b1232a2bf2e8d0cb2163c15c24af5023d5004d65/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Core.targets#L31

_UseLegacyJavadocImport is empty
DocumentationFile is empty

and global GenerateDocumentationFile is not honored at all.

Was able to disable this behaviour by setting _UseLegacyJavadocImport to true but don't know if it should work this way and what are future implications.

See discord discussion for reference: https://discord.com/channels/732297728826277939/732297837953679412/1070672188996337705

Steps to Reproduce

  1. Create Android Java Library Binding solution.
  2. Add some documentation over e.g. addition partial item
namespace some.namespace
{
    public partial class Test
    {
        /// <summary>
        /// Get the version in major.minor.build format.
        /// </summary>
        public static string SomeVersion { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();
    }
}
  1. Disable XML generation by leaving empty DocumentationFile or setting GenerateDocumentationFile false which should disable any documentation.
  2. dotnet pack solution and observe that DocumentationFile is overridden in the log and XML file is generated inside nupkg

Did you find any workaround?

It could be disabled by setting undocumented flag that was added by some other means:

Was able to disable this behaviour by setting _UseLegacyJavadocImport to true but don't know if it should work this way and what are future implications.

Relevant log output

`Property reassignment: $(DocumentationFile)="SomeFile.xml" (previous value: "") at /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/32.0.485/tools/Xamarin.Android.Bindings.Core.targets (27,5)`

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions