5

I am not able to get Fody.Costura running in a .NET Core 2.1 or .NET Standard 2.0 library. The wiki and open issues seem to not directly answer the question what has to be done differently than in a classic .NET Framework project (.exe or .dll).

  1. For testing purposes I created 4 projects:

    • A classic .NET Framework .exe and one .dll
    • A .NET Core 2.1 .dll
    • A .NET Standard 2.0 .dll
  2. I added Fody (latest 5.1) and Costura (latest 4.0) to all of the projects.

  3. Then I created the exactly same FodyWeaver.xml to all the projects.

  4. I made all projects depend on Newtonsoft.Json (added it per Nuget and created a class within each project that uses Newtonsoft.Json).

  5. I built them and examined the output -> Newtonsoft.Json was in no output directory as expected. But when looking at the created .dll files with ILSpy only the binaries from the .NET Framework projects contained a Resources folder where the Newtonsoft.Json.Dll was included.

enter image description here

From what I read in the wiki there should be no further setup. The issues do not say that .NET Core and Standard are NOT supported even if there are improvements etc. ongoing. Does anybody know how to get things working here? Any hint to a doc I did not recognize?

The final Dlls from the .NET Core and Standard project should include the Newtonsoft.Json.dll

Update 1

If I explicitly add IncludeAssemblies='Newtonsoft.Json' in the FodyWeavers.xml file the assembly is included as a resource (in both, the .NET Core and Standard). Is this the intended behaviour?

stev-e
  • 436
  • 6
  • 15

1 Answers1

1

Costura should only be used on the top level project (the exe)

Simon
  • 33,714
  • 21
  • 133
  • 202
  • Hi @Simon, the projects are not depending on each other (not referencing each other). I only made a solution with different project types for testing purposes. Is this still true then? Please see my latest update for further details. – stev-e Aug 01 '19 at 05:38
  • @stev-e it is difficult to work out what the problem is without a downloadable repro. i suggest u raise an issue and follow the issue template https://github.com/Fody/Costura/issues/new?template=bug_report.md – Simon Aug 01 '19 at 08:18