[英]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. 我正在尝试为我们的Windows应用商店应用程序执行命令行程序包部署。
My command line instructions are: 我的命令行说明是:
msbuild /m /p:Configuration=Debug /p:Platform=x86 /target:Build
I'm using VS2013 Professional with Windows 8.1 我在Windows 8.1上使用VS2013 Professional
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.
C:\\ Program Files(x86)\\ MSBuild \\ Microsoft \\ VisualStudio \\ v12.0 \\ AppxPackage \\ Microsoft.AppXPackage.Targets(1224,9):错误APPX0002:任务'GenerateAppxPackageRecipe'失败。 Value cannot be null.\\r [C:\\Path\\Project.csproj]
值不能为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]
C:\\ Program Files(x86)\\ MSBuild \\ Microsoft \\ VisualStudio \\ v12.0 \\ AppxPackage \\ Microsoft.AppXPackage.Targets(1224,9):错误APPX0002:参数名称: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. 使用正确版本的msbuild.exe解决了此错误在安装了VS2013的干净构建服务器上,安装了(至少)两个msbuild.exe副本。 In our case the install locations were:
在我们的例子中,安装位置是:
C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\msbuild.exe
C:\\ Program Files(x86)\\ MSBuild \\ 12.0 \\ Bin \\ msbuild.exe
and 和
C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe
C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ msbuild.exe
The one in the .Net Framework folder was the one that gave us the errors. .Net Framework文件夹中的那个是给我们错误的那个。 Using the version installed in the Program Files folder resolved the issue.
使用Program Files文件夹中安装的版本解决了该问题。
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外部构建(例如VisualStudioVersion)并且需要从命令行传递时,某些属性无法正确解析。 VS also uses msbuild to build your projects, so comparing build logs from VS and CMD should help you track down the problem.
VS还使用msbuild来构建项目,因此比较VS和CMD的构建日志应该可以帮助您跟踪问题。
I suggest, that you set visual studio's build output verbosity to diagnostic, clean solution, than build and capture the build log. 我建议,将visual studio的构建输出详细程度设置为诊断,清理解决方案,而不是构建和捕获构建日志。 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).
然后清理解决方案并从命令行进行构建,将详细程度设置为diagnostic和/ fl switch(登录到文件,因为诊断构建日志太长而无法在控制台窗口中进行分析)。
Compare command-line output to VS output. 将命令行输出与VS输出进行比较。 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).
有了详细程度的诊断级别,很有可能,你会发现缺少什么(由于VisualStudioVersion变量没有被正确解析,我遇到了数据库项目无法从cmd构建的类似问题,所以我从命令行传递了它)。
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. 对于那些面临混合应用程序问题的人(在我的情况下是corodova),手动删除构建文件夹并从VS重新构建。 Standard clean solution didn't do the job.
标准清洁解决方案没有完成这项工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.