使用ClickOnce部署System.Net.Http.dll [英] Deploying System.Net.Http.dll with ClickOnce

查看:97
本文介绍了使用ClickOnce部署System.Net.Http.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发要与ClickOnce一起部署的应用程序。从.NET 4.5降级到.NET 4.0并替换了对错误引用的修复之后,现在我的部署程序包出现了问题。某些文件,最重要的是 System.Net.Http.dll 没有与应用程序一起部署。我已经做了一些检查,但无法得出确切原因的结论。我怀疑是在创建软件包时期望该程序集已经存在于目标计算机上。如果目标框架是.NET 4.5,这是合理的,但现在不是.NET4。奇怪的是, System.Net.Http.Extensions.dll 得到正确的部署。 / p>

两个文件的设置和版本号相同:



引用相同的软件包:

 <参考Include = System.Net.Http,Version = 2.2.13.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a,processorArchitecture = MSIL> 
< HintPath> .. \packages\Microsoft.Net.Http.2.2.13\lib\net40\System.Net.Http.dll< / HintPath>
< SpecificVersion> False< / SpecificVersion>
< / Reference>
< Reference Include = System.Net.Http.Extensions,Version = 2.2.13.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a,processorArchitecture = MSIL>
< SpecificVersion> False< / SpecificVersion>
< HintPath> .. \packages\Microsoft.Net.Http.2.2.13\lib\net40\System.Net.Http.Extensions.dll< / HintPath>
< / Reference>

目标平台是.NET 4,部署先决条件也是.NET 4和KB更新。



文件甚至没有显示在应用程序文件对话框中:



有什么想法吗?如果其他所有方法都失败,我可能会尝试将程序集部署为内容文件。
删除并重新添加引用没有区别。

解决方案

Microsoft在 Visual Studio支持线程表示:



此问题将在Visual Studio 2013的下一次更新中修复。到那时,您将必须使用将程序集添加为链接的解决方法。



所以,我找到了下一个 解决方案(第8期)



发生这种情况是因为ClickOnce无法部署某些必需的程序集。解决方法是,执行以下操作:


  1. 右键单击该项目,然后选择添加现有项

  2. 浏览到HttpClient net40软件包文件夹

  3. 在文件名文本框中输入

  4. 按住CTRL键,然后选择System.Net.Http.dll和System.Net.Http.Primitives.dll

  5. 单击添加按钮旁边的向下箭头,然后选择添加为链接

  6. 在解决方案资源管理器中,按住CTRL键的同时选择System.Net.Http.dll和System.Net.Http.WebRequest.dll

  7. 右键单击所选内容,选择属性并更改复制输出目录以始终复制

  8. 重新发布

对于我来说,仅添加一个即可库 System.Net.Http


I'm developing an application which is to be deployed with ClickOnce. After downgrading from .NET 4.5 to .NET 4.0 and replacing repairing bad references, now I have problem with deployment package. Some files, most importantly System.Net.Http.dll are not deployed with the application. I've done some checks but can't conclude why exactly this happens. My suspicion is that package is created with expectation that this assembly already exists on target machine. This would be reasonable if target framework was .NET 4.5, but not now that it's .NET 4. Strangely, System.Net.Http.Extensions.dll gets deployed correctly.

Settings and version numbers are same for both files:

References are made to same package:

<Reference Include="System.Net.Http, Version=2.2.13.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net40\System.Net.Http.dll</HintPath>
  <SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Net.Http.Extensions, Version=2.2.13.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\packages\Microsoft.Net.Http.2.2.13\lib\net40\System.Net.Http.Extensions.dll</HintPath>
</Reference>

Target platform is .NET 4, and deployment prerequisite is also .NET 4 and a KB update.

File is not even displayed in Application Files dialog:

Any ideas? I might just try and deploy the assembly as a content file if all else fails. Removing and re-adding the reference did not make a difference.

解决方案

Posted message by Microsoft on Visual Studio support thread says that:

This will be fixed in the next update to Visual Studio 2013. Till then you will have to use the workaround of adding the assemblies as a link.

so, I found the next resolution (issue 8):

This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following:

  1. Right-click on the project and choose Add Existing Item
  2. Browse to the HttpClient net40 package folder
  3. In the File name text box enter .
  4. Holding CTRL, select System.Net.Http.dll and System.Net.Http.Primitives.dll
  5. Click the down-arrow next to the Add button and choose Add as Link
  6. In Solution Explorer, holding CTRL select System.Net.Http.dll and System.Net.Http.WebRequest.dll
  7. Right-click the selection, choose Properties and change Copy to Output Directory to Copy always
  8. Republish

In my case, enough to add only one library System.Net.Http.

这篇关于使用ClickOnce部署System.Net.Http.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆