简体   繁体   English

在两个Visual Studio项目之间共享类

[英]Sharing a class between two Visual Studio projects

I was looking for some help with sharing classes between 2 seperate projects in VS2012. 我在VS2012的2个独立项目之间共享类时寻求帮助。

I have added a new project called TaxiRouteModel and added a reference to it from my 2 other projects in the solution. 我添加了一个名为TaxiRouteModel的新项目,并在解决方案中的其他2个项目中添加了对该项目的引用。 Which seems to work just great. 这似乎工作得很好。 I no longer have to maintain 2 separate projects. 我不再需要维护2个单独的项目。

But the class library which is shared by both web projects will never be published to the website and the 2 web projects are published to 2 separate places. 但是,两个Web项目共享的类库将永远不会发布到网站,而2个Web项目将发布到2个单独的位置。

Once the websites have been published will they still be able to reference the class library? 网站发布后,他们仍然可以引用课程库吗?

Yes. 是。

When the web sites are compiled, the DLL is copied from the library project to the bin folder of the web site project, so when the web site is published it will also have the DLL from the library project. 编译网站时,DLL从库项目复制到网站项目的bin文件夹中,因此,在发布网站时,它也将具有库项目中的DLL。

Yes. 是。 As long as the DLL is available in the bin folder 只要DLL在bin文件夹中可用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM