c# – 如何创建库项目或重用代码

我正在开发
Android应用程序开发,现在我已经切换到Windows Phone 8应用程序开发,并且遇到了问题.

我有5个项目具有相同的架构(即UI和代码完全相同,但只有数据和应用程序名称不同).在Android中我们所做的是创建一个项目并将其作为库项目并使用它作为Jar文件并添加到其他应用程序.

例如:CommonProject作为库

Project 1

(a) Right-click on your project -> Properties

(b) In Android->Library section click Add CommonProject

有关更多详细信息,请参阅链接:How to add a Library Project to a android project?.

那么现在我如何在Windows Phone 8应用程序的Visual Studio 2012(C#)中实现相同的功能呢?

最佳答案 我认为您可以在
that documentation之后添加项目参考:

In Solution Explorer, select the Web project that you want to add the
project reference to.

On the Website menu (for Web site projects) or the Project menu (for Web application projects), choose Add Reference. Alternatively,
you can right-click your Web project in Solution Explorer and then
click Add Reference.

The Add Reference dialog box is displayed.

Click the Projects tab.

From the list of available projects, select the one to which you want to add a reference and then click OK.

The following are added to your Web project’s Bin folder:
A copy of the assembly created from the added project.
Copies of dependent assemblies, XML document files, license files, resource files, and so on.

点赞