exefodyfody-costura

C# - why costura and fody doesn't work to me?


(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


Solution

  • 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)

    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>-->
    

    If you don't know how to edit this file you can find the steps here: How to edit .csproj file