如何调试在Visual Studio类库 [英] How to debug a class library in Visual Studio

查看:541
本文介绍了如何调试在Visual Studio类库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个类库,在Visual Studio 2008(DLL)项目;编程在C#。为了测试我的DLL我刚刚创建的第二个项目是一个控制台应用程序,并在该项目中,我可以参考第一和运行测试。是否有这样做的一个简单的方法?我可以创造我的类库项目中的其他文件中有测试,然后以某种方式告诉Visual Studio运行该文件?

I am working on a class library (DLL) project in Visual Studio 2008; programming in C#. In order to test my DLL I just created a second project that is a console application and in that project I can reference the first and run tests. Is there a simpler way of doing this? Can I just create another file within my class library project that has the tests in it and then somehow tell Visual Studio to run that file?

我知道有一个方法是一个文本文件添加到我的项目,然后写在JScript中我的测试代码。然后在调试菜单上的项目设置,我可以告诉它启动外部程序(JScript中)。然后,我的测试文件的名称, test.js ,云在命令行参数框。但是,我想知道如果有一种方法使用C#代码,而不是JScript中办呢?

I know one way would be to add a text file to my project and then write my test code in JScript. Then in the Project settings on the debug menu I can tell it to Start External Program (JScript). Then, the name of my test file, test.js, goes in the Command Line Arguments box. But, I am wondering if there is a way to do it using C# code instead of JScript?

推荐答案

您可以添加一个测试项目当前解决方案,然后设置该项目为启动项目。然后,打在你的类库项目F5将开始您的测试项目。

You could add a testing project to your current solution, then set that project as the startup project. Then, hitting F5 on your class library project will start your testing project.

这篇关于如何调试在Visual Studio类库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆