Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
201 views
in Technique[技术] by (71.8m points)

c# - How to debug a class library in 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?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...