Nunit在VS中设置断点不能调试,断点走不到怎么办

我们找到Nunit的安装目录,比如我的安装目录如下:

C:\Program Files (x86)\NUnit 2.6.2\bin

找到这个目录下面的“nunit.exe.config”文件,

复制该文件,到桌面打开,把这句话“<loadFromRemoteSources enabled="true" />”粘贴进来:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <!--
   The GUI only runs under .NET 2.0 or higher. The
   useLegacyV2RuntimeActivationPolicy setting only
   applies under .NET 4.0 and permits use of mixed
   mode assemblies, which would otherwise not load
   correctly.
  -->
 <startup useLegacyV2RuntimeActivationPolicy="true">
  <!-- Comment out the next line to force use of .NET 4.0 -->
   <requiredRuntime version="v4.0.30319" />
 </startup>
 <runtime>
  <!-- Ensure that test exceptions don't crash NUnit -->
  <legacyUnhandledExceptionPolicy enabled="1"/>
  <!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
  <loadFromRemoteSources enabled="true"/>
  <!-- Look for addins in the addins directory for now -->
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <probing privatePath="lib;addins"/>
  </assemblyBinding>
 <loadFromRemoteSources enabled="true" />
 </runtime>
</configuration>

,把原来安装目录下面

C:\Program Files (x86)\NUnit 2.6.2\bin的“nunit.exe.config”删除,把桌面的“nunit.exe.config”拷进来就可以了

哦, 对了,需要补充一下,把单元测试的这一层项目,“右键”-“属性”-“调试” 的第二项,启动外部程序,需要把 Nuint的 执行文件目录填写(选择)进来

posted @ 2013-09-30 13:43  丑陋的侧面  阅读(672)  评论(0)    收藏  举报