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
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.