简体   繁体   中英

MSBuild fails due to error APPX0002: Task 'GenerateAppxPackageRecipe' failed. Value cannot be null

I'm attempting to do a command line package deploy for our Windows Store Application.

My command line instructions are:

msbuild /m  /p:Configuration=Debug /p:Platform=x86 /target:Build

I'm using VS2013 Professional with Windows 8.1

I get the following error:

C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v12.0\\AppxPackage\\Microsoft.AppXPackage.Targets(1224,9): error APPX0002: Task 'GenerateAppxPackageRecipe' failed. Value cannot be null.\\r [C:\\Path\\Project.csproj]

C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v12.0\\AppxPackage\\Microsoft.AppXPackage.Targets(1224,9): error APPX0002: Parameter name: source\\r [C:\\Path\\Project.csproj]

How should I resolve this?

This error was resolved by using the correct version of msbuild.exe On a clean build server with VS2013 installed, there are (at least) two copies of msbuild.exe installed. In our case the install locations were:

C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\msbuild.exe

and

C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe

The one in the .Net Framework folder was the one that gave us the errors. Using the version installed in the Program Files folder resolved the issue.

It's impossible to help you without having the code which can reproduce the error. I suspect some property does not resolve correctly when building outside VS(eg VisualStudioVersion) and needs to be passed from command line. VS also uses msbuild to build your projects, so comparing build logs from VS and CMD should help you track down the problem.

I suggest, that you set visual studio's build output verbosity to diagnostic, clean solution, than build and capture the build log. Then clean solution and build from command line with verbosity set to diagnostic and /fl switch(log to file, because diagnostic build log is way too long to analyse in console window).

Compare command-line output to VS output. Look for the differences. With diagnostic level of verbosity, chances are, you'll find out what's missing (I had similar issues with database projects failing to build from cmd due to VisualStudioVersion variable not being resolved correctly, so I passed it from command line).

NB: diagnostic log is very verbose which makes analysis hard: I'd start from detailed verbosity level.

我已从“project”/ bin文件夹中删除了所有文件/文件夹,清理了解决方案并成功重建!

For those facing the issue on hybrid app (corodova in my case), delete the build folder manually and re-build from VS. Standard clean solution didn't do the job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM