Windows Phone 7 development in a virtual machine
Monday, 13 June 2011
For developing apps for Windows Phone 7 I’m running Windows 7 in a virtual machine using VMware Fusion. As long as you keep all your project files locally in your virtual machine everything works fine. But as soon you’ll use any remote files, maybe some generated files out of a running Eclipse instance on your Mac host machine, which are reachable through a shared folder, you’ll get in trouble, because Visual Studio won’t build your project anymore and leaves you with this error message:
Error 1 Could not load the assembly file:///Z:\itemisApp.wp7\obj\Debug\ItemisApp.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information. ItemisApp
If you follow the given link, you’ll be informed that you have to unblock these “web assemblies” and give them trust in order to be build within Visual Studio. The solution seems annoying but easy. So I used the Explorer to navigate to my shared folder, right-clicked and selected properties to find out that there was no unblock button.
The note on the website says:
The Unblock button will not appear if the assembly is already unblocked and available.
Ok, now what?
After a little research I found this website: http://mobileworld.appamundi.com/blogs/petevickers/archive/2010/08/15/windows-phone-7-vs2010-and-vmware.aspx
There, the same error is described and the solution looked promising. All you have to do is to add this entry
<loadFromRemoteSources enabled="true"/>
into the file ‘devenv.exe.config’, somewhere in the <runtime> section.
Problem is, there was no such file.
To keep it short: If you have Visual Studio Express installed you’ll have to search for the file ‘VPDExpress.exe.config’ and add the implied line into it.
I was not able to find this file with the file search from the ‘start’-menu, but you’ll find it in a sub-directory where you’ve installed Visual Studio Express into. In my case it was ‘C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\’. Trust me, it’s there. Ok, you won’t see the extension ‘.config’ anyway, but if you open ‘VPDExpress.exe’ with a text editor (I used Notepad++) it is the ‘.config’ file. To be able to save your changes you’ll need admin rights.
After a restart of Visual Studio and a rebuild of the project the error message disappears.
No. 1 — June 14th, 2011 at 00:26
Marcus, AWESOME post. Great sol’n to an irritating situation. I found another proposal but that didn’t work for me. Thanks for your effort!
No. 2 — October 14th, 2011 at 16:11
Big thanx for sharing your experiences!
I’m about to start develop for WP7 in VMWare Fusion on a MBP. I’ve found some other posts saying it’s not possible (for example: http://bit.ly/mWphAj). Did you have to tweak anything else, or did the development environment work out of the box?
No. 3 — November 19th, 2011 at 21:30
You saved my day, Marcus! Thanks a lot
No. 4 — November 21st, 2011 at 09:32
@Jonathan: Although Microsoft states that it is impossible to run the emulator in a virtual machine (http://msdn.microsoft.com/en-us/library/ff637317(v=vs.92).aspx#BKMK_VM) it worked out of the box for me. However, since the release of Mango you’ll get a very annoying warning every time you launch the emulator. It seems to be the best solution to debug and test on an actual device.