Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Introduction

Portable Class Libraries issues may occur after you install Microsoft Visual Studio 2012 Update 2. This article describes those issues and their workarounds.

Issue 1

Symptoms

When you use resources to build a Portable Class Library project after you install Visual Studio 2012 Update 2, you may receive the following error messages:

'System.Type' does not contain a definition for 'Assembly' and no extension method 'Assembly' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)

Note You receive this error when you use Microsoft Visual C#.

'Assembly' is not a member of 'System.Type'

Note You receive this error when you use Microsoft Visual Basic.

This issue occurs when one of the following platforms is targeted in your project:

  • The Microsoft .NET Framework 4.5 and the .NET for Windows Store apps

  • The .NET Framework 4.5 and Windows Phone 8

  • The .NET Framework 4.5, the .NET for Windows Store apps, and Windows Phone 8


Workaround

To work around this issue, fix the designer-generated code of the resources file. To do this, double-click the error message, and then follow these steps:

For Visual C#

  1. Add the following using directive:

    using System.Reflection;
  2. Find the following code:

    typeof(Resource1).Assembly

    Replace that code with the following code:

    typeof(Resource1).GetTypeInfo().Assembly

The following code is an example that has this issue:

        /// <summary> 

/// Returns the cached ResourceManager instance used by this class.

/// </summary>

[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]internal static global::System.Resources.ResourceManager ResourceManager { get {

if (object.ReferenceEquals(resourceMan, null)) {

global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PortableClassLibrary2.Resource1", typeof(Resource1).Assembly);

resourceMan = temp;

}

return resourceMan;
}
}


Visual Basic

  1. Add the following using directive:

    Imports System.Reflection;
  2. Find the following code:

    GetType(Resource1).Assembly

    Replace that code with the following code:

    GetType(Resource1).GetTypeInfo().Assembly

The following code is an example that has this issue:

        '''<summary>

''' Returns the cached ResourceManager instance used by this class.

'''</summary>

<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _

Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager

Get

If Object.ReferenceEquals(resourceMan, Nothing) Then

Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("PortableClassLibrary1.Resource1", GetType(Resource1).Assembly)

resourceMan = temp

End If

Return resourceMan

End Get

End Property

Issue 2

Symptoms

You cannot use resources to build a Portable Class Library project after you install Visual Studio 2012 Update 2. Additionally, you may receive one of many different error messages. For example, you may receive one of the following error messages:

The type 'System.Net.HttpStatusCode' 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'.


Cannot implicitly convert type 'System.Net.HttpStatusCode' to 'System.Net.HttpStatusCode [%programfiles%\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\System.Net.Primitives.dll]'


Note This issue occurs when one of the following platforms is targeted in your project:

  • The .NET Framework 4.5 and Windows Phone 8

  • The .NET Framework 4.5, the .NET for Windows Store apps, and Windows Phone 8


Cause

This issue occurs because Visual Studio 2012 Update 2 was installed after the Windows Phone Software Development Kit (SDK) 8.0 was installed. Therefore, the following files were deleted:

  • %programfiles%\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile49\System.Net.dll

  • %programfiles%\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile49\System.ServiceModel.dll

  • %programfiles%\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\System.Net.dll

  • %programfiles%\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\System.ServiceModel.dll


Workaround

To resolve this issue, run the Visual Studio 2012 repair program. To do this, follow these steps:

  1. Click Start, click Control Panel, click Programs, and then click Programs and Features.

  2. Right-click the version of Visual Studio 2012 that you have installed, and then click Change.

  3. Click Repair when the Visual Studio 2012 Setup wizard opens.

Note If you set up a new developer environment, to avoid this issue, you should install Visual Studio 2012 Update 2 before you install the Windows Phone 8.0 SDK.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×