2016-12-06 70 views
0

对于TFS 2013(以及旧的XAML构建配置),您如何为Android项目生成APK文件?我一直在构建项目,但是在日志文件夹中出现此错误,即使构建“发布”配置Xamarin.Android与TFS 2013的持续集成和测试

1> C:\ Program Files(x86)\ MSBuild \ 12.0 \ bin \ Microsoft.Common .CurrentVersion.targets(618,5):警告:OutputPath属性未为项目“Project.Android.csproj”设置。请检查以确保您已为该项目指定了Configuration和Platform的有效组合。配置='发布'平台='混合平台'。您可能会看到此消息,因为您正在尝试构建没有解决方案文件的项目,并且指定了此项目不存在的非默认配置或平台。

该文件夹中没有任何东西存在。我遵循Xamarin文档中的步骤,但它似乎不适用于TFS2013: https://developer.xamarin.com/guides/cross-platform/ci/tfs_walkthrough/add-build-definition/

回答

0

配置构建定义时,TFS2013的用户界面非常相似。你有“5.高级”小标题下提供一些额外的参数的MSBuild:

MSBuild Arguments in Advanced Section

,因为你没有指定为构建输出路径你所得到的“OutputPath”的错误。现在的APK,在命令行建立的时候,你必须提供一个额外的参数:“/ T:PackageForAndroid”

你必须把这个与其他的MSBuild论据是这样的组合:

/p:AndroidSdkDirectory=c:\android-sdk /p:Configuration=Release 
/p:Platform="AnyCPU" /p:OutputPath="bin/Release" /t:PackageForAndroid 

如果你没有任何其他错误,你的构建应该是成功的!这是我们从Xamarin论坛为例PowerShell脚本(2013年左右),其中包括签署和拉链对准以及:

# First clean the Release target. 
msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:Clean 

# Now build the project, using the Release target. 
msbuild.exe HelloWorld.csproj /p:Configuration=Release /t:PackageForAndroid /p:Platform="AnyCPU" /p:OutputPath="bin/Release" 

# At this point there is only the unsigned APK - sign it. 
# The script will pause here as jarsigner prompts for the password. 
# It is possible to provide they keystore password for jarsigner.exe by adding an extra command line parameter -storepass, for example 
# -storepass <MY_SECRET_PASSWORD> 
# If this script is to be checked in to source code control then it is not recommended to include the password as part of this script. 

& 'C:\Program Files\Java\jdk1.8.x.x\bin\jarsigner.exe' -verbose -sigalg MD5withRSA -digestalg SHA1 
-keystore ./xample.keystore -signedjar 
./bin/Release/helloworld-signed.apk 
./bin/Release/helloworld.apk publishingdoc 

# Now zipalign it. The -v parameter tells zipalign to verify the APK afterwards. 

& 'C:\Program Files\Android\android-sdk\tools\zipalign.exe' -f -v 4 
./bin/Release/helloworld.apk ./newAPK.apk 

对于签名和拉链心,你可以参考Xamarin.Android docs on this matter.

+0

您可以标记它作为答案 –