"Target IncrementalClean" 正在删除 pdb 文件

pdb file is being removed by "Target IncrementalClean"

我现在正在处理的项目有问题。问题是 Visual Studio 不会在任何断点处停止。然后我查看 bin 文件夹,但根本看不到 .pdb 文件。

这解释了为什么我的断点没有被击中。然后我开始调查,我发现每当我使用 Mac 的 Visual Studio 在 MacOS 中编译这个项目时。我在构建输出中得到这个条目。

Target CopyFilesToOutputDirectory:
   Copying file from "obj/Debug/HelloWorld.dll" to "bin/Debug/HelloWorld.dll".
   HelloWorld -> /Users/frank_underwood/Documents/Github/HelloWorld/bin/Debug/HelloWorld.dll
   Copying file from "obj/Debug/HelloWorld.pdb" to "bin/Debug/HelloWorld.pdb".
Target IncrementalClean:
   Deleting file "/Users/frank_underwood/Documents/Github/HelloWorld/bin/Debug//HelloWorld.pdb".

是的,最后一行中的“//”不是我打错的,但条目就是这样生成的。

这是我的环境:

csproj 文件如下所示: https://gist.github.com/danielmahadi/9e13ac73ef41be6d0e6bdddc4f19d985

这里有人遇到过这种情况吗?如何解决这个问题?我可以做进一步的调查吗?

谢谢。

Has this ever happen to anyone here? How to resolve this? any further investigation that I can do?

我也无法用你的 csproj 重现这个问题,我没有直接解决这个问题的方法,但我可以为你提供一个临时解决这个问题的方法。

您可以添加一个新的目标,将必要的文件复制到目标文件夹。 例如(编辑 csproj 文件,将此代码添加到末尾(之前):

<Target Name="CopyFiles" AfterTargets="Build">
  <Copy
       SourceFiles="obj\Debug\HelloWorld.pdb"
       DestinationFolder="bin\Debug"
    />

更新:

我找到了一个similar issue on Github,如果可能的话,你可以获得一些关于这个问题的更多有用的信息。

希望对您有所帮助。