Today while deploying one of my new Windows Phone 7 application to my unlocked WP7 device, I noticed that, it is not deploying it due to connection error though the device is connected properly and able to sync with the Zune Software.
Later after doing lots of brain storming I was able to fix the problem and thus sharing the solution here in case you came across similar issue while deploying.
What was the Issue?
I had a fresh new system with Windows 8 Ultimate (64-bit), Visual Studio 2012 Update 1 and Windows Phone 8 SDK. It was the first time I was building an app for Windows Phone 7 in that system and thus I needed to test it in my physical Windows Phone device. But while trying to deploy, I got a deployment failure message in the screen that says:
“Error 1 Connection to device failed. For connecting to Windows Phone 8 device - Deployment failed because no Windows Phone 8 phone was detected. Make sure a phone is connected and powered on.
For Windows Phone 7 device - Failed to connect to the device. Ensure that the device is completely booted and is connected to the PC.”
And in the Visual Studio error list, it was displaying as shown in the below screenshot:
I tried to deploy in the physical device several times but both the time I was facing the same issue. Tried in the emulator and it was working perfectly there. I opened the “Application Deployment Tool” that comes with the SDK but there also I was getting the same error message as shown below:
First I thought that it could be a connection error as the message stated but next time I realised that the Zune software is already connected to the device and was able to sync the data available on my phone device. Then what’s wrong? After thinking for several times, I rebooted my system and also rebooted my Windows Phone; no good result though.
After trying lots of other good/bad possibilities, I thought to repair the installation of the WP8 SDK as the WP7 SDK for Visual Studio 2012 comes with the same. But before doing that, I thought to try deploying it once again and this time fortunately or unfortunately (whatever you say), the deployment was successful. At that point, I was not aware of the reason behind it.
Started breaking my heads once again to find out the reason but this time instead of the deployment error, it was the reason that it worked.
The Exact Reason behind this Issue
Finally after spending little more time, I found the exact root cause behind it. Yes, it was the exact reason. The Wi-Fi of the Windows Phone was turned ON while deploying the application XAP file in it. When the same was not there, it was able to deploy it perfectly.
To confirm myself on this serious issue, I reproduced it once again with the Wi-Fi settings turned ON and then turning OFF it. Yes, that worked. Bloody hell, there were no documentation of this from the WP Team.
So if you came to this situation in your system or a friends of yours, first check whether the Wi-Fi settings is turned ON in the phone (developer unlocked). If it is, try deploying it once again after switching OFF the Wi-Fi connection. I am sure that it will work for you too irrespective of the system you are trying to.
If that didn’t work and you find a different solution for that, do share it in the comments section and help others to resolve it quickly by following your steps. I hope that, this post was helpful for you if you came here by searching it online. Though it was a lengthy one describing the issue and my steps towards resolving it, but I think that it was needed to tell you the exact steps I followed. Happy coding.