Portable Class Library unusable - you must add a reference to assembly 'System.Net, Version=2.0.5.0 - by dp30

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 808382 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 11/12/2013 1:09:55 PM
Access Restriction Public

Description

We have a Portable Class Library targeting 4.0. A WPF application references this which is a standard .NET 4.0 app.

The PCL references the System.Net.NetworkCredential class.

When we build the .NET 4.0 app we get an error:

The type 'System.Net.NetworkCredential' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.

Several posts say to install KB2468871. That doesn't apply/change things.

If we add an assembly reference to "System.Net 4.0.0.0" in the app then the error changes:

Reference to type 'System.Net.NetworkCredential' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Net.dll', but it could not be found...

Of course NetworkCredential is not in System.Net, it is in the System assembly.

If I retarget to 4.5 everything works, but we need to use 4.0.
Sign in to post a comment.
Posted by dp30 on 11/16/2013 at 12:43 PM
Hi David,

The act of completely uninstalling VS2012 and reinstalling appears to fix the issue. We had already added the assembly as described in my post below, and that was not working but now is without any other change.

We have 3 PCs doing this, so some order of install/upgrade of VS/other tools is breaking PCL and requiring a reinstall to fix.

Thanks,

Dave
Posted by David [MSFT] on 11/15/2013 at 2:04 PM
Thanks for the feedback. I've provided more information on this page: http://stackoverflow.com/questions/19936503/portable-class-library-you-must-add-a-reference-to-assembly-system-net-versi/19967939#19967939.

Basically, adding a reference to System.Net, 4.0.0.0 should fix the issue. If it does not, then you're install is incomplete, you should repair your Visual Studio installation if using VS 2012/2013, or reinstall Portable Library Tools if using VS 2010.

Regards

David Kean
Posted by David [MSFT] on 11/15/2013 at 2:03 PM
Thanks for the feedback. I've provided more information on this page: http://stackoverflow.com/questions/19936503/portable-class-library-you-must-add-a-reference-to-assembly-system-net-versi/19967939#19967939.

Basically, adding a reference to System.Net, 4.0.0.0 should fix the issue. If it does not, then you're install is incomplete, you should repair your Visual Studio installation if using VS 2012/2013, or reinstall Portable Library Tools if using VS 2010.

Regards

David Kean
Posted by Macy [MSFT] on 11/12/2013 at 9:32 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Macy [MSFT] on 11/12/2013 at 1:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)