是否可以根据程序集输出定义变量?
类似这样的东西:
if (assembly is .exe)
{
Path = "this/path"
}
else if (assembly is .dll)
{
Path = "this/path"
}
我需要一个基于程序集的变量的不同路径,因为我有时将程序运行为.exe,有时将其构建为.dll并在另一个程序/PC中运行。
多亏了@aoakad的预处理器定义提示和一些谷歌搜索,我找到了答案:
#ifdef _WINDLL
Path = "this/path";
#else
Path = "other/path";
#endif