如何以编程方式将构建日期硬编码到程序集中

发布于 2024-12-10 13:51:14 字数 68 浏览 1 评论 0原文

我想将构建日期硬编码到我的程序集中。

我可以轻松地手动完成此操作,但是有什么方法可以通过构建过程来实现吗?

I want to hard-code the date of build into my assembly.

I can easily do that manually but is there some way it can be achieved by the build process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

物价感观 2024-12-17 13:51:14

请参阅http://social.msdn.microsoft.com/Forums/ar/tfsbuild/thread/7fdeabcc-2ef1-4c4f-9798-b69ebee0c3a3

一旦您能够获取时间戳,您可以将其放置在您的财产中,如下所示:

<ItemDefinitionGroup>
  <ClCompile>
    <PreprocessorDefinitions>BUILD_TIME=$(Timestamp);%(PreprocessorDefinitions)</PreprocessorDefinitions>
  </ClCompile>
</ItemDefinitionGroup>

See http://social.msdn.microsoft.com/Forums/ar/tfsbuild/thread/7fdeabcc-2ef1-4c4f-9798-b69ebee0c3a3

Once you are able to get the timestamp, you can place it in your property like so:

<ItemDefinitionGroup>
  <ClCompile>
    <PreprocessorDefinitions>BUILD_TIME=$(Timestamp);%(PreprocessorDefinitions)</PreprocessorDefinitions>
  </ClCompile>
</ItemDefinitionGroup>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文