运行时判断"Visual Studio Hosting Process"是否启用?

Determine at runtime whether the "Visual Studio Hosting Process" is enabled?

C#VB.Net中,如何确定Visual Studio我的 运行 应用程序启用了托管进程 调试功能?

c#: if (Debugger.IsAttached = true)

vb: If Debugger.IsAttached Then

编辑:忽略上面那一点,我理解错了,试试这个:

if (AppDomain.CurrentDomain.FriendlyName.EndsWith("vshost.exe"))

或另一个:

if (Assembly.GetCallingAssembly().FullName.Contains("mscorlib"))

但是是的,如果您随后将程序集命名为 mscorlib,您可能 运行 会遇到问题...