简体   繁体   English

C#项目-本机.dll的参考.pdb

[英]C# Project - Reference .pdb for native .dll

I have a solution containing a C# Forms project that creates a UI on top of a native .dll which contains most of my program's code. 我有一个包含C#Forms项目的解决方案,该项目在包含我程序大部分代码的本机.dll上创建一个UI。

I spend most of my time working on the native code reather than C#, which means that the DLL I'm loading through my C# UI project is modified very often, and so is it's associated .pdb file which I need for debugging what I do. 我将大部分时间都花在了本机代码而不是C#上,这意味着我通过C#UI项目加载的DLL经常被修改,因此它是相关的.pdb文件,我需要对其进行调试以进行调试。

However it is not possible to reference a .pdb file like one would reference a .dll, so how could I make this .pdb be copied everytime it is modified ? 但是,不可能像引用一个.dll那样引用.pdb文件,因此,如何在每次修改该.pdb时复制该文件? Adding it as an existing item is just copying it and doesn't update it when the original .pdb file gets modified. 将其添加为现有项只是对其进行复制,而在修改原始.pdb文件时不会对其进行更新。

Two only solution I see is generating the .pdb file directly into the C#'s bin/debug instead of generating it inside the native .dll project, but I'm not sure this is possible. 我看到的两个唯一解决方案是将.pdb文件直接生成到C#的bin / debug中,而不是在本机.dll项目中生成它,但是我不确定这是可能的。 Second solution would be to add a link to that .pdb file into the project instead of the actual .pdb file, but I'm not sure that it would work any way. 第二种解决方法是将指向该.pdb文件的链接添加到项目中,而不是实际的.pdb文件中,但是我不确定它是否可以正常工作。

Is there a workaround to this ? 有解决方法吗? I couldn't find any. 我找不到。 Thank you. 谢谢。

MSVC provides Build-Events (MSVC++ 2010: project's properties -> 'Configuration Properties' -> 'Build Events' – this exists for C# and in later MSVC versions, too, possibly at another location, however). MSVC提供了构建事件(MSVC ++ 2010:项目的属性->'配置属性'->'构建事件'– C#和更高版本的MSVC版本中也存在此属性,但是可能在其他位置)。 You can define pre- and post-build events there (in case of C++, pre-link events, too). 您可以在那里定义构建前和构建后事件(对于C ++,也可以定义链接前事件)。

You can call shell commands, call a batch script, or (if you have installed an appropriate interpreter) event perl or python scripts. 您可以调用shell命令,调用批处理脚本或(如果已安装了适当的解释器)事件perl或python脚本。 From within such a script (either as post build for the dll, copying the .pdb file away, or – what I would prefer personally – from within the C# project as pre build event). 从这样的脚本中进行(例如为dll进行后生成,将.pdb文件复制掉,或者-我个人更喜欢-在C#项目中作为预生成事件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM