简体   繁体   English

在Windows Store应用程序和WCF服务之间共享项目

[英]Share project between Windows Store Application And WCF Service

Is it possible to create and "share" a class library project between an Windows Store Application and WCF Service project ? 是否可以在Windows Store应用程序和WCF服务项目之间创建和“共享”类库项目?

I created Windows Store Application project and WCF Service project. 我创建了Windows Store Application项目和WCF Service项目。 Now, both projects should refer a Class library project. 现在,两个项目都应引用类库项目。

If I create a regular Class Library project, the WCF Service project can refer it. 如果我创建一个常规的类库项目,则WCF服务项目可以引用它。 But when I add the reference to the Windows Store Application Visual Studio 2012 says : 但是,当我添加对Windows应用商店应用程序的引用时,Visual Studio 2012会说:

Unable to add the reference to project XXX 无法添加对项目XXX的引用

So I decided to replace the regular Class Library project by a Class Library(Windows Store apps). 因此,我决定用一个类库(Windows Store应用程序)替换常规的类库项目。 Now the Windows app project can refer the Class Library(Windows Store apps). 现在,Windows应用程序项目可以引用类库(Windows应用商店应用程序)。 But when I add the reference to the WCF Service Visual Studio says : 但是,当我添加对WCF服务的引用时,Visual Studio会说:

Unable to add the reference to project XXX 无法添加对项目XXX的引用

To share code between the two projects create a Portable Class Library (PCL) project and reference it in the two projects. 要在两个项目之间共享代码,请创建一个可移植类库(PCL)项目,并在两个项目中对其进行引用。

Make sure you choose the right .Net framework (for compatibility with WCF project). 确保选择正确的.Net框架(与WCF项目兼容)。

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

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