Fody 在错误的目录中查找中间文件

Fody looks for intermediate files in the wrong directory

为了能够发布单个 .exe,我已将 Costura/Fody 包添加到我的 C# 项目中。我以前使用过这个包,但现在我收到以下错误消息:

MSBUILD : error : Fody: AssemblyPath "C:\Projects\X\MSBuild\obj\x86\Debug\X.exe" does not exists. If you have not done a build you can ignore this error. Finished Fody 4ms.

奇怪的是,中介 X.exe 在这里正确构建:

C:\Projects\X\src\X\obj\x86\Debug\X.exe

我正在进行的项目相当大。所以我们使用几个 MSBuild props 文件将所有内容放在 corect 输出目录中。使用 MSBuild 从命令行构建和从 Visual Studio 中构建都可以正常工作。所以我假设我们的道具文件是正确的。为什么 Fody 会在如此奇怪的地方寻找中介机构?

Fody 可能使用哪个 MSBuild 变量控制此中间路径?

正在查看 the code that throws the exception, I see a very simple File.Exists check. It all stems from ProjectDirectory (in a WeavingTask) and you can check the places where the value is used here

因为我没有用过Fody,所以我不能告诉你更多。我会特别注意配置文件,因为我没有看到 ProjectDirectory 在任何地方构建,只是从某个地方注入。