我在C#visual studio项目中遇到以下错误:
命名空间"Microsoft"中不存在类型或命名空间名称"VisualStudio"(您是否缺少程序集引用?)
我也试图找到microsoft.dll文件,但无法获得任何参考.我在搜索错误的DLL吗?
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Kya.MsFx.Services.Swiper;
namespace Kya.MsFx.Devices.Swiper.Test
{
[TestClass]
public class SwiperWindowTest
{
private SwiperWebServiceHost m_SwiperWS = null;
/// <summary>
/// start web service on a separate thread, so tests
/// can be executed withut blocking the application thread
/// </summary>
[ClassInitialize]
public void SetupSwiperTests() {
m_SwiperWS = SwiperWebServiceHost.StartService();
}
/// <summary>
/// Stop service started during class initialize and kill the thread
/// </summary>
[ClassCleanup]
public void CleanupSwiperTests() {
m_SwiperWS.Stop();
}
/// <summary>
/// simulate init, …Run Code Online (Sandbox Code Playgroud) 我在VS2010 Express中编写了一系列单元测试,并测试它们有时会失败的测试.由于VS的快速版本不允许插件运行,我不能简单地启动TestDriven.Net或等效的并调试测试.为了尝试解决这个问题,我将测试程序集转换为控制台应用程序,并使main方法如下所示:
class CrappyHackToDebugUnitTestInVSExpress
{
public static void Main()
{
AppDomain.CurrentDomain.ExecuteAssemblyByName(
@"C:\Program Files\NUnit 2.5.5\bin\net-2.0\nunit-console.exe",
new [] { Assembly.GetExecutingAssembly().Location, "/framework:4.0" });
}
}
Run Code Online (Sandbox Code Playgroud)
理论上我应该能够运行它,在我的测试中设置断点.如果它工作,这将是一个可接受的工作,但我一直得到以下:
FileLoadException
Could not load file or assembly 'C:\\Program Files\\NUnit 2.5.5\\bin\\net-2.0\\nunit-console.exe'
or one of its dependencies. The given assembly name or codebase was invalid.
(Exception from HRESULT: 0x80131047)
Run Code Online (Sandbox Code Playgroud)
现在文件存在,当手动运行时,nunit-console运行正常.可能是我的问题?