是否可以从同一解决方案中的另一个项目引用VS2005网站项目? [英] Is it possible to reference a VS2005 website project from another project in the same solution?

查看:100
本文介绍了是否可以从同一解决方案中的另一个项目引用VS2005网站项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将nunit测试添加到VS2005 C#ASP.NET网站项目中-这样我就可以在App_Code目录中执行方法. 建议将测试作为单独的程序集添加,以使测试代码不会随网站一起提供-这是我的问题:

I'd like to add nunit testing to a VS2005 C# ASP.NET website project - so that I can excercise methods in the App_Code directory. It's recommended that the tests are added as a seperate assembly so that the testing code does not get delivered with the website - in this lies my question:

当我将新项目添加到包含网站的解决方案中并尝试添加对网站项目的引用时,它不会显示在项目"选项卡中-是否可以从另一个项目引用网站项目(而无需将网站项目转换为Web应用程序项目)?

When I add a new project into the solution which holds the website and try to add a reference to the website project it does not show up in the projects tab - is it possible to reference a website project from another project (without having to convert the website project into a web application project)?

推荐答案

我建议您提取App_Code文件夹中的类并将它们放在单独的项目中.在您的Web项目中引用该新项目.现在,您可以更好地分离项目和类,并且可以分别对类进行单元测试.

I would recommend you to extract the classes you have in your App_Code folder and place them in a separate project. Reference that new project in your web project. You will now have a better separation of your projects and classes, and can unit test your classes separately.

这篇关于是否可以从同一解决方案中的另一个项目引用VS2005网站项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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