I have the same problem. In further text I'll describe step by step how I am trying to solve it as I stumble upon new problems.
I have added msbuild to my Environment path as follows:
;C:\Windows\Microsoft.NET\Framework\v4.0.30319
(I have .NET 4.5 installed as part of Visual Studio 2013 but it does not appear as a separate folder, since 4.5 is inplace upgrade).
At first I created my empty test project:
cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add wp8
Everything fine so far. Then I did
cordova run
And failed the same way as you did. Full build log is here: http://pastebin.com/Wk4c5xWC
But now I managed at least to build and deploy. According to Microsoft instructions to redirect references automatically, you have to specify additional flag in the project file. Unfortunately, this flag seems to be new to .NET 4.5 so Cordova does not include it. Let's fix it ourselves.
Open
C:\Users\developer.cordova\lib\wp\cordova\3.4.0\wp8\template\cordova\lib\CordovaDeploy\CordovaDeploy\CordovaDeploy.csproj
with your favorite text editor. Find the section:
<PropertyGroup>
<StartupObject>CordovaDeploy.DeployTool</StartupObject>
and add this code
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Then we try to workaround the storage method call issue.
Open
C:\Users\developer\.cordova\lib\wp\cordova\3.4.0\wp8\template\cordova\lib\CordovaDeploy\CordovaDeploy\Program.cs
and change
GetIsolatedStore()
to
GetIsolatedStore(null)
In the path, replace developer
with your Windows user name. After that you need to recreate your project or update the existing one with the same changes as described above.
Although there are still some warnings in the CLI, but at least now it builds and launches the emulator.
But now it says:
CordovaDeploy.exe compiled, SUCCESS.
Deploying to emulator ...
Connecting to device :: A6BAF594-9315-40C3-AD16-F5B8A425A7AB : Emulator 8.1 WVGA
4 inch 512MB
Installing app on Emulator 8.1 WVGA 4 inch 512MB
Launching app on Emulator 8.1 WVGA 4 inch 512MB
The system cannot find the file specified.
Unfortunately, there is no file name mentioned. Nevertheless, the emulator is being launched and now it show me a nice Cordova logo with text Device is ready
.
Then I noticed that obviously my Path is pointing to a wrong msbuild version. It seems, 4.5 framework is not completely in-place upgrade for 4.0. If I run msbuild from VS prompt, it shows:
Microsoft (R) Build Engine version 12.0.30324.0
[Microsoft .NET Framework, version 4.0.30319.34014]
but nodejs console says:
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34014]
Looking for the answer:
http://msdn.microsoft.com/en-us/library/hh162058.aspx
MSBuild is now installed as part of Visual Studio rather than as part of the .NET Framework.
Oh, Microsoft, you make thing complicated for us.
I changed the path from
;C:\Windows\Microsoft.NET\Framework\v4.0.30319
to
;C:\Program Files (x86)\MSBuild\12.0\Bin
and now no more warnings about referece conflicts. Still the same error "The system cannot find the file specified." after emulator starts.
While debugging the CordovaDeploy application I found that it's trying to open debugOutput.txt
file. But when I enlist all files with var list = isoFile.GetDirectoryListing(null)
I get the following output:
%FOLDERID_APPID_ISOROOT%\{cf473982-be59-4824-81ef-f04d20829bcb}\%LOCL%\DeviceID.txt
%FOLDERID_APPID_ISOROOT%\{cf473982-be59-4824-81ef-f04d20829bcb}\%LOCL%\Shared
As you see, there is no debugOutput.txt
there. I thought maybe Microsoft or Cordova team has removed it or moved it somwhere else? But then whiule debugging I noticed that at one moment the file appeared and it came to me - maybe the CordovaDeploy tool is too fast for my emulator? I found this one:
// wait for the app to launch
Thread.Sleep(4000);
To be sure, I added the following code:
string dbFilePath = Path.DirectorySeparatorChar + "debugOutput.txt";
int waitForFileToAppear = 0;
while (!isoFile.FileExists(dbFilePath))
{
Thread.Sleep(1000);
waitForFileToAppear++;
if (waitForFileToAppear >= 60)
throw new InvalidOperationException("Cannot wait for debug output file anymore");
}
right below
GetIsolatedStore(null)
in botrh my project and the default template. Now CordovaDeploy didn't crash anymore - it just hangs there doing nothing and also the demo app is just flashing that "Device is ready" message. As I found out, that's exactly what it's supposed to do. Well, I hoped for something like "This is an emty page. Fill it with your ideas" instead of the cryptic "Device is ready" but at least it works now.
I'm really sorry for the long answer but I wanted to show my entire debugging process so everyone could see what I might have done wrong because I'm just a beginner with Cordova and Windows Phone. Also, maybe Cordova team stumbles upon this and learns their lessons.