针对多个版本的组件System.Net.Http所产生的本机映像

人气:1,028 发布:2022-09-10 标签: .net c# windows-phone-8.1 background-task

问题描述

我这是使用BackgroundTask项目WNS和定时器任务的Windows Phone 8.1的Silverlight应用程序。我真的得到关于调用从BackgroundTask项目的一些方法,以下错误:

I have Windows Phone Silverlight 8.1 application which is using BackgroundTask project for WNS and timer tasks. I`m getting following error on calling some method from BackgroundTask project:

ERROR:针对多个版本的组件所产生的本机映像   System.Net.Http。

ERROR: Native images generated against multiple versions of assembly System.Net.Http.

有没有人有一些想法在这里可问题?

Does anyone have some idea where can be problem?

推荐答案

我发现了一个问题:

我有参考DAL项目(WP的Silverlight 8.1)的Windows Phone的Silverlight 8.1的主要项目(从WP8转换为IBackgroundTask支持)。另外我有一个后台任务项目(WP8.1)参考DAL项目(WP 8.1)。这两个DAL项目(连接类)使用System.Http类。

I have Windows Phone Silverlight 8.1 main project (converted from WP8 for IBackgroundTask support) referenced to DAL project (WP Silverlight 8.1). Also I have a background task project (WP8.1) referenced to DAL project (WP 8.1). Both DAL projects (linking classes) are using System.Http classes.

在主WP的Silverlight 8.1的项目需要的是使用DAL WP8.1项目的一些功能后台任务WP8.1方法时发生错误。这时的环境负荷DAL WP8.1 dll的参考,以不同的版本System.Http库。

Error occurs when main WP Silverlight 8.1 project calls method of background task WP8.1 which is using some features of DAL WP8.1 project. At this moment environment loads DAL WP8.1 dll with reference to different version of System.Http library.

解决方案:我搬到从后台任务计划功能,DAL的项目,并不调用后台任务的项目方法主要WP的Silverlight 8.1的应用程序

Solution: I moved functionality from background task project to DAL project and do not call methods of background task project in main WP Silverlight 8.1 application.

457