【问题标题】:Use TFS 2013 to version Windows Store App Builds使用 TFS 2013 版本 Windows Store App Builds
【发布时间】:2014-12-15 17:10:09
【问题描述】:

我们正在使用 TFS 2013 来管理我们的 Windows 应用商店应用的源代码。不幸的是,看起来我们必须手动更改版本号。这是乏味且容易忘记的。如果我们两次使用错误的构建,我们必须采取额外的步骤来部署。有没有办法在构建服务器构建时设置版本号?

【问题讨论】:

  • 这不适用于我收集的 Windows 运行时(Windows 应用商店)应用程序。我会试一试,看看会发生什么。
  • @DanielMann 它不适用于 Windows Store 应用程序。
  • 看来我错了!恭敬地收回。 :)
  • 问题在 Visual Studio 中没有增加。这很好用。问题是我们的构建不是在 Visual Studio 中完成的,它们是由我们的 TFS 2013 服务器完成的。有没有办法以这种方式执行此操作?

标签: c# windows tfs windows-runtime windows-store-apps


【解决方案1】:

您需要在构建服务器上执行 PowerShell 预构建以更新内部版本号。 TFS 社区构建工具中有一个示例脚本。

https://curah.microsoft.com/8047/run-scripts-in-your-team-foundation-build-process

查找 ApplyVersionToAssemblies.ps1。您必须进行自定义以更新您需要的任何清单文件...

【讨论】:

    【解决方案2】:

    我找到了解决方案。这将修改 appmanifest 中的版本号。我不确定来源,如果有人会发布来源,我会将其添加到此评论中。

    这是我添加到项目源代码管理并将其设置为运行预构建的 powershell 脚本。对我来说,这对每个构建来说都是一种魅力。这正是我想要它做的。

    # get the build number, we assume the format is Myproject.Main.CI_1.0.0.18290
    # where the version is set using the TFSVersion custom build activity (see other posts)
    $buildnum = $env:TF_BUILD_BUILDNUMBER.Split('_')[1]
    # get the manifest file paths
    $files = Get-ChildItem -Path $env:TF_BUILD_BUILDDIRECTORY -Filter "Package.appxmanifest" -Recurse
    foreach ($filepath in $files)
    {
        Write-Host "Updating the Store App Package '$filepath' to version ' $buildnum '"
        # update the identity value
        $XMLfile=NEW-OBJECT XML
        $XMLfile.Load($filepath.Fullname)
        $XMLFile.Package.Identity.Version=$buildnum
        # set the file as read write
        Set-ItemProperty $filepath.Fullname -name IsReadOnly -value $false
        $XMLFile.save($filepath.Fullname)
    }
    

    【讨论】:

      猜你喜欢
      • 2013-12-28
      • 1970-01-01
      • 2013-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多