Visual Studio 2012 throws an error saying: “Visual Studio encountered an unexpected network error and can’t contact the Microsoft account service” when you try to “Create App Packages…” for the Windows Store.

You have developed a Windows Store app and are in the process of building your app package and uploading it to the Windows Store using Visual Studio 2012. During this process, Visual Studio should bring up a dialog that lets you sign-in with your Windows Live Credentials, however you get an error from Visual Studio 2012 that looks like this:

 

 

 

Note: This problem does not seem to happen with Visual Studio 2012 Express version.

 

One of the reasons you can encounter this issue is if you are trying to deploy your application within a network environment that has a Proxy server which requires Integrated Windows authentication, i.e NTLM/ Negotiate authentication scheme.

 

Before Visual Studio communicates with the Windows Live service to bring up the sign-in page, it performs a check to see if Windows Live URL can be accessed. It is during this check that the above issue happens because the proxy provides an authentication challenge and Visual Studio is unable to authenticate to the proxy thus resulting in the above error.

By default, Visual Studio is not configured to use your logged on credentials for authenticating with the proxy and you need to explicitly allow Visual Studio do this.

The problem should be resolved once you configure Visual Studio to use your default/ logged on users credentials to authenticate with the Proxy.

 

To resolve this issue, perform the following steps:

1.)   Close all open instances of Visual Studio 2012 running on the machine

2.)   Make a copy of the devenv.exe.config file that resides in the Visual Studio installation location. By default, this location is: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

3.)   From an elevated command prompt open the devenv.exe.config file from the above folder

4.)   Look for the following section towards the end of the file:

    <system.net>

            <settings>

                <ipv6 enabled="true"/>

            </settings>

    </system.net>

 

5.)   Add the following line inside the <system.net> section of the file and save the file

 

    <defaultProxy useDefaultCredentials="true" enabled="true" />

 

6.)   Your final setting should look like this:

    <system.net>

           <defaultProxy useDefaultCredentials="true" enabled="true" />

           <settings>

               <ipv6 enabled="true"/>

           </settings>

    </system.net>

 

7.)   Close and restart any open instances of Visual Studio running on the machine

8.)   Once Visual Studio is restarted it will pick up the new settings from the changed configuration and if you now try to “Create App Packages…”, you should not longer run into the above issue. Visual Studio should now be able to authenticate through the Proxy using Integrated Windows
authentication (i.e. NTLM/Negotiate authentication scheme) and passing in your default/ logged on users credentials.

 

Comments are welcome, both below and on twitter: #WSDevSol.