2016-07-12 91 views
0

我試圖按照官方xamarin教程使用WCF服務從Xamarin形式PCL項目(​​URL /引導/跨平臺/ application_fundamentals/web_services/walkthrough_working_with_WCF /上Xamarin網站)無法添加System.ServiceModel NuGet包在Xamarin形式PCL項目

然而,在引用System.ServiceModel NuGet包的時候,我碰到下面的錯誤和封裝不會安裝:

Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

我也試過輪廓78無運氣(我刪除了Windows Phone 8.1,因爲沒有WCF支持,所以解釋爲here)。

我試圖爲PCL項目不同的配置文件作爲解釋here,但沒有成功。

而且,我嘗試使用軟件包管理控制檯並得到了類似的錯誤:

 PM> Install-Package -Verbose 
    cmdlet Install-Package at command pipeline position 1 
    Supply values for the following parameters: 
    Id: System.ServiceModel 
    GET ... OK 
    Attempting to gather dependency information for package 'System.ServiceModel.1.0.0' with respect to project 'Mobile\MobileCashRegister', targeting '.NETPortable,Version=v4.5,Profile=Profile7' 
    Attempting to resolve dependencies for package 'System.ServiceModel.1.0.0' with DependencyBehavior 'Lowest' 
    Resolving actions to install package 'System.ServiceModel.1.0.0' 
    Resolved actions to install package 'System.ServiceModel.1.0.0' 
    Install failed. Rolling back... 
    Package 'System.ServiceModel.1.0.0' does not exist in project 'MobileCashRegister' 
    Package 'System.ServiceModel.1.0.0' does not exist in folder 'C:\dev\DevCuddlUpSolution\packages' 
    Install-Package : Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', but the package does not contain any assembly 
    references or content files that are compatible with that framework. For more information, contact the package author. 
    At line:1 char:1 
    + Install-Package -Verbose 
    + ~~~~~~~~~~~~~~~~~~~~~~~~ 
     + CategoryInfo   : NotSpecified: (:) [Install-Package], Exception 
     + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand 

我怎樣才能知道需要選擇成功地安裝了System.ServiceModel NuGet包的配置文件?

請注意我使用Visual Studio 2015年專業版和最新的可用Xamarin。

回答

0

System.ServiceModel 1.0.0在任何lib文件夾中都不包含任何程序集。它似乎只包含NuGet.exe,所以你將無法使用它。

它也不是一個微軟官方的NuGet包。

+0

嗨馬特,謝謝你的提示。在清理我的項目並重新啓動Visual Studio後,似乎編譯器不再抱怨一些丟失的包。它編譯正確,沒有在此頁面中提到的3個nuget軟件包:https://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/ – Christophe

相關問題