build: Resolve issue with FodyWeavers
Task Request
Task Overview
Fix FodyWeavers adding FodyWeavers.xml/.xsd to projects on build
Whilst trying to build and test Elsa 3 from branch main, I'm being hit by 2 issues both related to #7983
When building the solution Fody is not finding the FodyWeavers.xml files that it is expecting, and is adding both a FodyWeavers.xml file and the associated xsd file to any project that it thinks needs it at the current branch date, thats is 28 projects.
The build log shows these as:
1>MSBUILD : warning : Fody: Could not find a FodyWeavers.xml file at the project level (D:\github\elsa-core\src\common\Elsa.Features). A default file has been created. Please review the file and add it to your project.
If then rebuild again with the files in place, you are then hit by the ELSA0002 build guard that was added in #7983
ELSA0002 Elsa.Api.Client has a FodyWeavers.xml, which the WeaverConfiguration MSBuild property silently overrides. Delete the file; the ConfigureAwait directive belongs in src/Directory.Build.props only. Elsa.Api.Client (net10.0), Elsa.Api.Client (net8.0), Elsa.Api.Client (net9.0) D:\github\elsa-core\Directory.Build.targets 29
Purpose of the Task
This is required to resolve build issues for developers and/or ci pipelines
Potential Issues
A workaround is to add an empty FodyWeavers.xml in the Solution root (with the associated xsd file) which stops the Fody Task from generating the missing files, however this will no doubt break Fody throughout the project
Impact of Task
Resolve the build Task
Additional Context
The issue arises because the FodyTasks only searches in 3 location for the FodyWeavers.xml file see ConfigFileFinder.cs
and does not support having the configuration in the Directory.build.props
Source: elsa-workflows/elsa-core