简体   繁体   English

有xbuild / t:Package支持吗? (TravisCI)

[英]Is there xbuild /t:Package support? (TravisCI)

(somewhat related issue ) (有点相关的问题

TravisCI supports C# builds and Elastic Beanstalk deployments. TravisCI支持C#构建和Elastic Beanstalk部署。 Cool. 凉。 But I can't get the Package target to build my zip file that gets deployed into EBS IIS. 但是我无法获得Package目标来构建要部署到EBS IIS中的zip文件。

My .travis.yml file looks like: 我的.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 --version
Mono JIT compiler version 4.0.1 (tarball Thu May 28 09:08:28 UTC 2015)

The (OK) build message is: (确定)生成消息为:

...
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)

The (FAIL) /t:Package message looks like: (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)

So my question is, why Target named 'Package' not found in the project ? 所以我的问题是,为什么Target named 'Package' not found in the project I've verified /t:Package works fine with MSBuild on a Windows machine. 我已经验证了/t:Package在Windows机器上可以与MSBuild正常工作。

Note: I've found that if I add an empty target into the .csproj file like 注意:我发现如果我向.csproj文件中添加一个空目标,例如

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

It no longer complains about a missing target, but does nothing: 它不再抱怨缺少目标,而是不执行任何操作:

...
/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)

Any xbuild help would be greatly appreciated. 任何xbuild帮助将不胜感激。

So my question is, why Target named 'Package' not found in the project? 所以我的问题是,为什么在项目中找不到名为“ Package”的Target? I've verified /t:Package works fine with MSBuild on a Windows machine. 我已经验证了/ t:Package在Windows机器上可以与MSBuild正常工作。

xBuild not a 100% replacement for MSBuild. xBuild不能100%替代MSBuild。 MSBuild has now been open sourced and work is being done to get is to play nice in an xplat world, but it is not there yet... MSBuild现在已经开源,正在努力在xplat世界中发挥出色,但是还不存在...

So when xbuild complains about the Package target missing from your project, that is because it is not defined in the targets that are available 'out of the box' for xbuild. 因此,当xbuild抱怨项目中缺少Package目标时,这是因为未在xbuild可用的目标中定义它。 It very well might be written as a platform dependent dll that MSBuild loads/executes and there was not public information on what they were doing and thus is never got any focus at Xamarin, and/or not enough people needed that feature. 很有可能将其编写为MSBuild加载/执行的依赖于平台的dll,并且没有公开的信息说明它们在做什么,因此永远不会将重点放在Xamarin上,并且/或者没有足够的人需要该功能。 Plus /t:package creates files like "myApp.deploy.cmd" that would not work on *nix.... 再加上/ t:package会创建“ myApp.deploy.cmd”之类的无法在* nix上运行的文件。

So you are on the right track, add a Package target to your project and define the tasks that you need it to do to emulate what the built-in Web packaging infrastructure Package is doing on Windows, but in a xplat env. 因此,您处于正确的轨道上,将Package目标添加到项目中,并定义您需要执行的任务,以模拟Windows在xplat env中内置Web打包基础结构Package所做的工作。 I would assuming some message, Path combines, exec and copy tasks to create/move the zip file. 我假设一些消息,Path组合,执行和复制任务以创建/移动zip文件。 If you really need the "myApp.SetParameters.xml" file, you could task that also. 如果您确实需要“ myApp.SetParameters.xml”文件,则可以执行此任务。

xbuild v12 predefined Targets in "Microsoft.Common.targets" “ 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 Tasks (define in v12 / Microsoft.Build.Tasks.*) : 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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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