部署时的 C# 项目、正确的版本控制、公司等

发布于 2024-11-25 14:36:41 字数 332 浏览 1 评论 0原文

我的公司正在努力将我们的开发从 C++.net 转移到 C#。我们的产品有标准的每月版本(例如,5.0.19.2...)。

在 C++.net 中,我们有一个通用的 app.rc 文件,它标准化了公司信息以及版本号。由于解决方案中的每个项目都将包含相同的 app.rc 文件一次,因此更改 200 多个项目的版本信息非常容易。

该解决方案如何转化为 C# 世界?我在写这篇文章之前检查的问题通过解决方案资源管理器中的属性窗口提到了它,但这不是我想要的。

我知道 assemblyinfo.cs 包含我想要修改的信息,但我不认为我可以拥有一个主文件。我需要将其分成多个文件吗?

提前致谢!

My company is working towards moving our development from C++.net into C#. Our product has standard monthly release (for instance, 5.0.19.2...).

In in C++.net, we had a common app.rc file, that standardized the company info, as well as version number. Since every project within the solution would include the same app.rc file once, it was very easy to change the version info on over 200 projects.

How does this solution translate into the C# world? The questions that I checked before writing this mention it through the property window in the solution explorer, but that is not what I want.

I know the assemblyinfo.cs contains the information I want to modify, but I don't think I could have one master file. Do I need to split it up into multiple files?

Thanks in advance!

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

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

发布评论

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

评论(5

〃安静 2024-12-02 14:36:41

您可以添加文件作为链接而不是实际文件。例如,我的解决方案可能是:

Solution
    - My Project
        - Properties
            - AssemblyInfo.cs
            - SharedAssemblyInfo.cs (Linked)
    - Solution Items
        - SharedAssemblyInfo.cs

当您将现有项目添加到解决方案时,您可以使用添加链接上的下拉箭头,然后选择添加为链接。 SharedAssemblyInfo.cs 文件可以包含公共/共享程序集属性,例如:

[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]

[assembly: AssemblyCompany("My Company")]

...等。项目本地可以包含项目特定属性:

[assembly: AssemblyTitle("My Assembly")]

...等。

You can add a file as a link instead of the actual file. E.g, my solution could be:

Solution
    - My Project
        - Properties
            - AssemblyInfo.cs
            - SharedAssemblyInfo.cs (Linked)
    - Solution Items
        - SharedAssemblyInfo.cs

When you add an existing item to the solution, you can use the drop down arrow on the Add link, and select Add as Link. The SharedAssemblyInfo.cs file can contain common/shared assembly attributes, e.g.:

[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]

[assembly: AssemblyCompany("My Company")]

... etc. The project local can contain project specific attributes:

[assembly: AssemblyTitle("My Assembly")]

... etc.

梦一生花开无言 2024-12-02 14:36:41

C# 解决方案中的常见做法是在每个项目的 assemblyinfo.cs 中注释掉版本信息,然后拥有一个通用的“shared_assembleinfo.cs”(按口味命名),其中包含版本信息并在所有项目之间共享...

It's a common practice in c# solutions to comment out version information in the assemblyinfo.cs of each project and then have a single common "shared_assemblyinfo.cs" (named to taste) that contains version information and is shared across all projects...

眼藏柔 2024-12-02 14:36:41

您可以拥有一个程序集信息文件,并且仅在其中指定程序集版本:

using System;
using System.Reflection;

[assembly: AssemblyVersion("1.0.0.0")]

然后,您只需添加 文件作为每个其他项目的链接(您必须从每个项目中删除 AssemblyVersion 属性)不过,Properties\AssemblyInfo.cs 是手动文件)。当他们构建时,他们都会使用这个文件。

You can have one assembly info file and only specify the assembly version in it:

using System;
using System.Reflection;

[assembly: AssemblyVersion("1.0.0.0")]

Then, you just add the file as a link to each of your other projects (you'll have to remove the AssemblyVersion attribute from each of the Properties\AssemblyInfo.cs files by hand though). When they build, they'll all use this file.

薯片软お妹 2024-12-02 14:36:41

可以使用主 assembly.cs - 只需删除项目的 assembly.cs 文件,然后使用“添加文件”对话框中的“作为链接”选项将主 assembly.cs 重新添加到每个项目中。

http:// www.tigraine.at/2009/01/22/sharing-a-common-assembleinfo- Between-projects-in-a-solution/

A master assembly.cs is possible - simply delete your project's assembly.cs file, and re-add a master assembly.cs to every project with the "As a Link" option in the "Add File" dialog.

http://www.tigraine.at/2009/01/22/sharing-a-common-assemblyinfo-between-projects-in-a-solution/

谷夏 2024-12-02 14:36:41

我建议为每个项目提供版本信息,考虑到它们有 400 个或可能如此之大,了解每个新的大型设置中哪些版本的程序集构成该设置的一部分非常重要。每个程序集都由不同的人开发,就像一个单独的项目,最后他们在主应用程序的一个大马赛克中完成,并带有 MainVersion。

问候。

I would suggest to have version information for every project, considering that they are 400 or could be so big, it's extremely important to know on every new big setup which versions of assemblies make part of that setup. Every assembly developed by different person(s) like a separate projects and finally they finished in one big mosaic of your main app, with it's MainVersion.

Regards.

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