Deploying System.Net.Http.dll with ClickOnce

http://stackoverflow.com/questions/18827611/deploying-system-net-http-dll-with-clickonce

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.

shareimprove this question

up vote3down voteaccepted

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.

shareimprove this answer

   

I’m accepting this because of link to a support thread although it didn’t solve the problem for me. But at least it lets me know MS is aware of the problem. I solved the problem for myself by creating a powershell script to create the deployment, using mage.exe. Unfortunately, this isn’t as simple as it should be. – Nikola Radosavljević Sep 20 ’13 at 14:17

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s