是否有xbuild/t:包支持?(TravisCI)

本文关键字:支持 TravisCI 包支持 xbuild 是否 | 更新日期: 2023-09-27 17:59:52

(有些相关的问题)

TravisCI支持C#构建和Elastic Beanstalk部署。凉的但是我无法获得Package目标来构建部署到EBS IIS中的zip文件。

我的.travis.yml文件看起来像:

language: csharp
solution: RestfulWCFService.sln
mono:
  - latest
script:
  - xbuild RestfulWCFService.sln /p:Configuration=Release /p:Platform="Any CPU" ## OK
  - xbuild RestfulWCFService.csproj /t:Package /p:Configuration=Release ## FAIL!
deploy:
  - provider: elasticbeanstalk
  ....

单声道版本:

$ mono --version
Mono JIT compiler version 4.0.1 (tarball Thu May 28 09:08:28 UTC 2015)

(OK)构建消息为:

...
Done executing task "CallTarget"
Done building target "Build" in project "/home/vagrant/syllabus/RestfulWCFService.sln".
Done building target "Build" in project "/home/vagrant/syllabus/RestfulWCFService.sln" ("/home/vagrant/syllabus/RestfulWCFService.sln").
Done building project "/home/vagrant/syllabus/RestfulWCFService.sln".
Build succeeded.
Warnings:
/home/vagrant/syllabus/RestfulWCFService.sln (default targets) ->
(Build target) ->
/home/vagrant/syllabus/RestfulWCFService.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (ResolveAssemblyReferences target) ->
        /usr/lib/mono/4.5/Microsoft.Common.targets:  warning : Reference 'System.Web.Entity' not resolved
         1 Warning(s)
         0 Error(s)

(FAIL)/t:Package消息看起来像:

...
/home/vagrant/syllabus/RestfulWCFService.csproj: Importing project /usr/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets from extension path /usr/lib/mono/xbuild
Building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
Done building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
/home/vagrant/syllabus/RestfulWCFService.csproj: error : Target named 'Package' not found in the project.
Done building project "/home/vagrant/syllabus/RestfulWCFService.csproj".-- FAILED
Build FAILED.
Errors:
/home/vagrant/syllabus/RestfulWCFService.csproj (Package) ->
        /home/vagrant/syllabus/RestfulWCFService.csproj: error : Target named 'Package' not found in the project.
         0 Warning(s)
         1 Error(s)

所以我的问题是,为什么是Target named 'Package' not found in the project?我已经验证了/t:Package在Windows计算机上与MSBuild配合良好。

注意:我发现,如果像一样在.csproj文件中添加一个空目标

[Target Name="Package"']
[/Target]

它不再抱怨目标丢失,但什么也不做:

...
/home/vagrant/syllabus/RestfulWCFService.csproj: Importing project /usr/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets from extension path /usr/lib/mono/xbuild
Building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
Done building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
Building target "Package" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/home/vagrant/syllabus/RestfulWCFService.csproj").
Done building target "Package" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/home/vagrant/syllabus/RestfulWCFService.csproj").
Done building project "/home/vagrant/syllabus/RestfulWCFService.csproj".
Build succeeded.
         0 Warning(s)
         0 Error(s)

任何xbuild的帮助都将不胜感激。

是否有xbuild/t:包支持?(TravisCI)

所以我的问题是,为什么在项目我已验证/t:Package与Windows上的MSBuild配合使用效果良好机器

xBuild不是MSBuild的100%替换。MSBuild现在已经是开源的,我们正在努力让它在xplat世界中表现得更好,但它还没有实现。。。

因此,当xbuild抱怨您的项目中缺少Package目标时,那是因为它没有在xbuild"开箱即用"的目标中定义。它很可能被编写为MSBuild加载/执行的依赖于平台的dll,并且没有关于他们正在做什么的公开信息,因此在Xamarin从未得到任何关注,和/或没有足够的人需要该功能。Plus/t:package创建的文件如"myApp.deploy.cmd",在*nix上不起作用。。。。

因此,您正走在正确的轨道上,将Package目标添加到您的项目中,并定义您需要它执行的任务,以模拟内置Web打包基础结构Package在Windows上但在xplat-env中所做的工作。我假设有一些消息,Path组合、执行和复制任务来创建/移动zip文件。如果您确实需要"myApp.SetParameters.xml"文件,您也可以执行此任务。

"Microsoft.Common.Targets"中的xbuild v12预定义目标

Target Name="_ValidateEssentialProperties"
Target Name="PrepareForBuild" DependsOnTargets="$(PrepareForBuildDependsOn)"
Target Name="AssignLinkMetadata"
Target Name="GetFrameworkPaths"
Target Name="GetReferenceAssemblyPaths" DependsOnTargets="$(GetReferenceAssemblyPathsDependsOn)"
Target Name="GenerateTargetFrameworkMonikerAttribute"
Target Name="ResolveReferences" DependsOnTargets="$(ResolveReferencesDependsOn)"
Target Name="BeforeResolveReferences"
Target Name="AfterResolveReferences"
Target Name="ResolveAssemblyReferences" DependsOnTargets="$(ResolveAssemblyReferencesDependsOn)"
Target Name="SplitProjectReferencesByExistent"
Target Name="_ComputeNonExistentFileProperty"
Target Name="BuildOnlySettings"
Target Name="BeforeBuild"
Target Name="AfterBuild"
Target Name="Build" DependsOnTargets="$(BuildDependsOn)" Outputs="$(TargetPath)"
Target Name="BeforeCompile"
Target Name="AfterCompile"
Target Name="Compile" DependsOnTargets="$(CompileDependsOn)"
Target Name="PrepareForRun" DependsOnTargets="$(PrepareForRunDependsOn)"
Target Name="PrepareResources" DependsOnTargets="$(PrepareResourcesDependsOn)"
Target Name="SplitResourcesByCulture" DependsOnTargets="AssignTargetPaths"
Target Name="GenerateSatelliteAssemblies"
Target Name="DeployOutputFiles"
Target Name="_CopyDeployFilesToOutputDirectory"
Target Name="_CopyDeployFilesToOutputDirectoryPreserveNewest"
Target Name="_CopyDeployFilesToOutputDirectoryAlways"
Target Name="_CopyAppConfigFile" Condition="'@(AppConfigWithTargetPath)' != ''"
Target Name="GetTargetPath" Outputs="$(TargetPath)"
Target Name="GetCopyToOutputDirectoryItems"
Target Name="PreBuildEvent"
Target Name="PostBuildEvent"
Target Name="_TimestampBeforeCompile" Condition="'$(RunPostBuildEvent)' == 'OnOutputUpdated'"
Target Name="_TimestampAfterCompile" Condition="'$(RunPostBuildEvent)' == 'OnOutputUpdated'"
Target Name="BeforeRebuild"
Target Name="AfterRebuild"
Target Name="Rebuild"
Target Name="_RecordCleanFile"
Target Name="_GetCompileOutputsForClean"
Target Name="_GetCleanFileWrites"
Target Name="CleanReferencedProjects"
Target Name="Clean" DependsOnTargets="$(CleanDependsOn)"
Target Name="BeforeClean"
Target Name="AfterClean"
Target Name="CoreClean" DependsOnTargets="_GetCleanFileWrites"
Target Name="ImplicitlyExpandDesignTimeFacades"

xbuild任务(在v12/Microsoft.Build.Tasks.*中定义):

Microsoft.Build.Tasks.AL"
Microsoft.Build.Tasks.AssignTargetPath"
Microsoft.Build.Tasks.AssignLinkMetadata"
Microsoft.Build.Tasks.AssignCulture"
Microsoft.Build.Tasks.AssignProjectConfiguration"
Microsoft.Build.Tasks.CallTarget"
Microsoft.Build.Tasks.CombinePath"
Microsoft.Build.Tasks.Copy"
Microsoft.Build.Tasks.CreateCSharpManifestResourceName"
Microsoft.Build.Tasks.CreateVisualBasicManifestResourceName"
Microsoft.Build.Tasks.CreateItem"
Microsoft.Build.Tasks.CreateProperty"
Microsoft.Build.Tasks.Csc"
Microsoft.Build.Tasks.Delete"
Microsoft.Build.Tasks.Error"
Microsoft.Build.Tasks.Exec"
Microsoft.Build.Tasks.FindAppConfigFile"
Microsoft.Build.Tasks.FindUnderPath"
Microsoft.Build.Tasks.GenerateResource"
Microsoft.Build.Tasks.GetAssemblyIdentity"
Microsoft.Build.Tasks.GetFrameworkPath"
Microsoft.Build.Tasks.GetFrameworkSdkPath"
Microsoft.Build.Tasks.GetReferenceAssemblyPaths"
Microsoft.Build.Tasks.LC"
Microsoft.Build.Tasks.MakeDir"
Microsoft.Build.Tasks.Message"
Microsoft.Build.Tasks.MSBuild"
Microsoft.Build.Tasks.ReadLinesFromFile"
Microsoft.Build.Tasks.RemoveDir"
Microsoft.Build.Tasks.RemoveDuplicates"
Microsoft.Build.Tasks.ResolveAssemblyReference"
Microsoft.Build.Tasks.SignFile"
Microsoft.Build.Tasks.Touch"
Microsoft.Build.Tasks.Vbc"
Microsoft.Build.Tasks.Warning"
Microsoft.Build.Tasks.WriteCodeFragment"
Microsoft.Build.Tasks.WriteLinesToFile"