ClickOnce部署使用的MSBuild - >如何通过目前的版本号为应用程序版本/或自动增量 [英] ClickOnce deployment with MSBuild -> How to pass the current build number for application version/ or autoincrement

查看:230
本文介绍了ClickOnce部署使用的MSBuild - >如何通过目前的版本号为应用程序版本/或自动增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Outlook插件中使用ClickOnce部署。

We have an Outlook add-in which is using ClickOnce deployment.

一旦在构建开发者检查,电脑排队一个构建和发布应用程序的某个位置共享驱动器上。

Once the developer check in the build, the PC queues a build and the application is published to a location on a shared drive.

的问题是,在生成不改变发布版本到当前集版本,因此,其发布在previous版本的文件夹其导致损坏的安装说,版本不能安装

The problem is that the build does not change the publish version to the current assembly version and therefore it publishes in the previous version's folder which results in a corrupted installer saying that the version cannot be installed.

我读过<一个href="http://stackoverflow.com/questions/8482360/how-can-i-get-msbuild-to-increment-clickonce-publish-revision-version-number-on">that文章。我设置了[总成:的AssemblyVersion(1.0。*)。仍然一无所获。

I've read that article. And I set up [assembly: AssemblyVersion("1.0.*")]. Still nothing.

我想出了一个办法来解决这个问题,通过增加&LT; ApplicationVersion&GT;&LT; / ApplicationVersion&GT; 在* .csproj的文件。但我想它是自动的。

I figured out a way to work around this problem by incrementing the <ApplicationVersion></ApplicationVersion> in the *.csproj file. But I want it to be automated.

执行msbuild.exe时,其他的解决方法是:

The other workaround was when executing msbuild.exe:

/target:publish   /property:PublishDir="\\sharedDir\\" /property:GenerateManifests=true
/property:ApplicationVersion=1.0.0.123

和它仍然不是自动的。我真的想为当前版本号通过其中的msbuild.exe或每个版本替换值&LT; ApplicationVersion&GT;&LT; / ApplicationVersion&GT; 与实际的构建数。或者有另一种方式?

And still it is not automated. I really would like to pass the current build number either to the msbuild.exe or on every build replace the value in <ApplicationVersion></ApplicationVersion> with the actual build number. Or is there another way?

推荐答案

我运行到同样的问题,这是我来到这里。我可以用code从你的问题为基础来解决。下面是步骤使用TFS来解决。

I was running into the same problem which is how I got here. I was able to solve using the code from your question as a base. Here are the steps to solve using TFS.

打开生成的模板和工作流的底部打开参数选项卡。查找MSBuildArguments并修改默认值。下面是我结束了:

Open your Build Template and open the Arguments tab at the bottom of the workflow. Find MSBuildArguments and modify the default value. Below is what I ended up with:

// Note: You can use /p for /property and /t for /target

"/t:Publish /p:PublishDir=<PublishDirectory> /p:ApplicationVersion="
    + Date.Today.ToString("yyyy") + "."
    + Date.Today.ToString("MMdd") + "."
    + Date.Now.Hour.ToString() + "."
    + Date.Now.Minute.ToString()

当然,现在你需要保存并签入新版本的文件。我只好让我的生成定义为使用新的价值的问题,所以我刚刚创建了一个新的构建定义。

Of course now you need to save and check-in your new build file. I had problems getting my build definition to use the new value, so I just created a new build definition.

这将创建像一个新的应用程序文件夹:

That will create a new Application folder like:

<ApplicationName>_2013_0315_09_55

我知道这是一个新的答案,一个旧的文章,所以我敢肯定你已经找到另一种解决办法,但我希望这可以帮助其他人谁想要使用ClickOnce部署TFS的。

I know this is a new answer to an old post, so I'm sure you've found another solution, but I hope this helps anyone else who wants to use ClickOnce deployment with TFS.

这篇关于ClickOnce部署使用的MSBuild - &GT;如何通过目前的版本号为应用程序版本/或自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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