Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning when referencing a project with GenerateDocumentationFile true #15897

Closed
mattjohnsonpint opened this issue Sep 7, 2022 · 3 comments · Fixed by #17908
Closed

Warning when referencing a project with GenerateDocumentationFile true #15897

mattjohnsonpint opened this issue Sep 7, 2022 · 3 comments · Fixed by #17908
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@mattjohnsonpint
Copy link

Migrated from dotnet/maui#7272

Steps to Reproduce

  1. Create solution with an iOS app that references a .NET 6 class library:
mkdir IosTest
cd IosTest
dotnet new sln
dotnet new ios -n MyTestApp
dotnet new classlib -n MyClassLib
dotnet sln add MyTestApp MyClassLib
dotnet add MyTestApp/MyTestApp.csproj reference MyClassLib/MyClassLib.csproj 
  1. Edit MyClassLib/Class1.cs and add an XML summary comment to the class:
namespace MyClassLib;

/// <summary>
/// Test Class
/// </summary>
public class Class1
{
}
  1. Edit MyClassLib.csproj and add the following to the <PropertyGroup> element to enable generating the documentation file:
 <GenerateDocumentationFile>true</GenerateDocumentationFile>
  1. dotnet build on the solution

Expected Behavior

It should build without warnings

Actual Behavior

The following warning is shown:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.4.447/targets/Xamarin.Shared.Sdk.targets(1444,3): warning : The file '/Users/matt/IosTest/MyClassLib/bin/Debug/net6.0/MyClassLib.xml' does not specify a 'PublishFolderType' metadata, and a default value could not be calculated. The file will not be copied to the app bundle. [/Users/matt/IosTest/MyTestApp/MyTestApp.csproj]

Environment

Version information

Output of dotnet --info:

.NET SDK (reflecting any global.json):
 Version:   6.0.400
 Commit:    7771abd614

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.5
 OS Platform: Darwin
 RID:         osx.12-arm64
 Base Path:   /usr/local/share/dotnet/sdk/6.0.400/

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: arm64
  Commit:       55fb7ef977

.NET SDKs installed:
  6.0.400 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Build Logs

msbuild.binlog.zip

Example Project

IosTest.zip

Workaround

Adding the following target to MyTestApp.csproj removes the warning.

<Target Name="_SetPublishFolderTypeNoneOnDocFileItems" BeforeTargets="_ComputePublishLocation">
  <ItemGroup>
    <ResolvedFileToPublish
      Update="@(ResolvedFileToPublish)"
      Condition="'%(ResolvedFileToPublish.Extension)' == '.xml' And '%(ResolvedFileToPublish.PublishFolderType)' == ''"
      PublishFolderType="None" />
  </ItemGroup>
</Target>
@mattjohnsonpint
Copy link
Author

Note: Also occurs for Mac Catalyst, but not for Android.

@rolfbjarne rolfbjarne added this to the .NET 8 milestone Sep 8, 2022
@rolfbjarne rolfbjarne added the enhancement The issue or pull request is an enhancement label Sep 8, 2022
@rolfbjarne
Copy link
Member

This is related to #14939, but the solution would be:

to amend our logic that figures out what to do with files in ResolvedFileToPublish (main/dotnet/BundleContents.md), to say something like: "If an xml file matches the filename of any assembly, then treat that xml file as PublishFolderType=None"

@Youssef1313
Copy link
Contributor

ComputeBundleLocation task should ignore FinalDocFile items.

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Mar 27, 2023
…Fixes xamarin#14939 and fixes xamarin#15897.

This fixes a warning when documentation is enabled for a project:

> The file '~/.nuget/packages/fsharp.core/6.0.0/contentFiles/any/netstandard2.1/FSharp.Core.xml' does not specify a 'PublishFolderType' metadata, and a default value could not be calculated. The file will not be copied to the app bundle.

This doesn't change any behavior (as the warning says, the file wasn't copied
to the app bundle before either), but it makes the behavior explicitly
documented and silences the warning.

Fixes xamarin#14939.
Fixes xamarin#15897.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
3 participants