命令行程序包服务结构应用程序 [英] Command-line Package Service Fabric Application

查看:72
本文介绍了命令行程序包服务结构应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到最近,我们的持续交付设置一直在使用以下命令交付Service Fabric软件包:

Our continuous delivery set-up, until recently, was delivering Service Fabric packages using the following command:

msbuild SFApp.sfproj /t:Package

这是必需的,因为目标 Package 在解决方案级别不可用.IE.命令

This was necessary because the target Package is unavailable at the solution level. I.e. The command

msbuild SFSolution.sln /t:Package

失败,因为目标不存在.

Fails, as the target does not exist.

随着我们的依赖关系网格的增长,到了这样一个程度,大多数接口项目将在没有解决方案文件的情况下无法构建("OutputPath不存在"红色鲱鱼).根据此答案,似乎有一种方法.不幸的是,虽然像 Clean 这样的目标起作用了……

As our dependency mesh grows, it gets to a point in which most interfaces projects will not build without a solution file (to work around the "OutputPath does not exist" red herring). There seems to be a way to do that according to this answer. Unfortunately, while targets like Clean work…

msbuild SFSolution.sln /t:SFApplication:Clean
(…snip…)
Build succeeded.
    0 Warning(s)
    0 Error(s)

…目标软件包不会!

msbuild SFSolution.sln /t:SFApplication:Package
(…snip…)
Build FAILED.
"SFSolution.sln" (SFApplication:Package target) (1) -> SFSolution.sln.metaproj :
        error MSB4057: The target "SFApplication:Package" does not exist in the
        project. [SFSolution.sln]
    0 Warning(s)
    1 Error(s)

(为清晰起见,省略了解决方案/项目文件夹/名称/措辞.如有必要,我可以提供实际的日志.)

所以问题是:如何使用命令行使用 Package 目标和 solution 文件构建一个项目?

So the question is: how could I, using the Command Line, build one project using the Package target and the solution file?

或者或者如何从命令行打包Service Fabric应用程序?

Or how can I otherwise package a Service Fabric application from the command line?

推荐答案

在不使用sln的情况下编译sfproj文件(以及任何其他项目文件)是个坏主意,因为它可能给引用的项目带来错误的内容.只有解决方案才能了解要在哪种配置中编译哪个项目.

It's bad idea to compile sfproj file(and any other project file) without sln, because it can bring wrong content to its output from referenced projects. Only solution has a knowledge about what project to compile in what configuration.

要使包类似于VS中的右键单击->包",请执行以下操作:只需将以下目标添加到您的sfproj

To make Package similar to "Right Click->Package" in VS: Just add to your sfproj the following target

  <Target Name="ForcePackageTarget" AfterTargets="Build" Condition="'$(ForcePackageTarget)' =='true'">
    <CallTarget Targets="Package"/>
  </Target>

然后运行正常的构建解决方案,您可以通过/p:ForcePackageTarget = true触发软件包步骤:

And then running normal build on solution you may trigger the package step by /p:ForcePackageTarget=true :

msbuild yoursolution.sln /t:Build /p:ForcePackageTarget=true /p:Configuration=Release /p:Platform=x64

实际上,它针对所有引用项目的解决方案配置执行二合一步骤,即构建和打包

Actually it performs two-in-one steps, build and package, with respect to Solution Configurations on all referenced projects

这篇关于命令行程序包服务结构应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆