8

(Translator used.) I was making an exe file using Costura and Fody. However, if the dll file is missing, it cannot run. And there is a warning in my Visual Studio. Warn: FodyPackageReference Fody: The package reference for Costura.Fody is missing the 'compile' part in the IncludeAssets setting; it's recommended to completely remove IncludeAssets

3 Answers3

12

I have this warn, too. But it works fine for me. So it's not the warn that leads to your issue.

In my opinion, maybe it's because the costura version does't fit your project. You can try an older version.

As for me, my project is using .NET Framework 4.6, and the latest costura.fody 5.3 version isn't compatible. But the 5.2 work fine.

And how to remove the warn: (edit the csproj file)

  1. Right-click on your project in solution explorer and select Unload Project Right-click on the project (tagged as unavailable in solution explorer) and click "Edit yourproj.csproj". This will open up your CSPROJ file for editing.
  2. find below and comment "IncludeAssets" line as below(by adding <!-- -->)
    <ItemGroup>
    <PackageReference Include="Costura.Fody">
    <Version>5.2.0</Version>
    <!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
  1. After making the changes, save, and close the file. Right-click again on the node and choose Reload Project when done.
Even Wonder
  • 1,127
  • 1
  • 14
  • 16
  • 2
    Oh my I just found this and set mine exactly like yours! Works like a charm been searching for this issue for hours on end :) – Chopnut Jul 24 '21 at 01:01
4

Looks like previous answer, I got rid of the warning this way:

  1. Double click on project node
  2. In CSPROJ file add "compile;":
    <IncludeAssets>runtime; compile; build;.....
  1. Reload project
Stepan
  • 41
  • 2
1

Actually, the error message tells you what to do: "... it's recommended to completely remove IncludeAssets".

More specifically, in your project file ( .csproj or .vbprog ) find where it says as an example:

  <PackageReference Include="Fody">
  <Version>6.3.0</Version>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  <PrivateAssets>all</PrivateAssets>
  </PackageReference>

and change it to:

    <PackageReference Include="Fody">
    <Version>6.3.0</Version>
    <PrivateAssets>all</PrivateAssets>
    </PackageReference>

(i.e. remove the <IncludeAssets .....> line entirely).

Doing this, as applicable, for both costura and fody.

Rob
  • 3,488
  • 3
  • 32
  • 27
  • have you reported this to the Fody repository? I am confused by this warning and am wondering if it is safe to do as Visual Studio advises. – wh1t3cat1k Feb 21 '22 at 08:39