VS2010自定义构建

发布于 2024-12-11 15:35:52 字数 408 浏览 0 评论 0原文

我有一个 C#/WPF 应用程序。我正在尝试创建不同的版本,以带有其品牌的方式运送给不同的客户。 该品牌当前位于 AssemblyInfo.cs 中,包括图标、启动屏幕、exe 名称。

我认为我可以创建单独的项目配置,然后我认为我可以为每个客户创建单独的 AssemblyInfo.cs 文件。

但该项目似乎只允许一个程序集信息,并且不允许在每个配置的基础上更改它(例如,它是“项目属性”对话框中的第一个选项卡)。

是否有一种更好的方法可以将 AssemblyInfo.cs 信息放入资源中,然后拥有多个资源文件(每个客户一个),并具有链接到不同资源的单独配置?

我希望在继续开发时,我可以在本地品牌下进行开发,然后批量构建所有发布版本,为每个客户生成可执行文件。

关于如何制定可维护的解决方案的任何帮助或建议都会很棒。

I have a C#/WPF app. I am trying to create different versions that will ship to different customers with their branding.
The branding is currently in the AssemblyInfo.cs, an icon, splash screen, exe name.

I thought I could create separate project configurations and then I thought I could just create separate AssemblyInfo.cs files for each customer.

But the project seems to only allow one assemblyinfo and does not allow this to be changed on a per configuration basis (e.g. it is the first tab in the Project Properties dialog).

Is a better way to somehow put the AssemblyInfo.cs info in a resource and then have multiple resource files, one for each customer, and have separate configurations that link in the different resource?

I was hoping then as I continued development, I could develop under the native branding and then just Batch Build all the release builds to produce the exes for each customer.

Any help or suggestions on how I can make a maintainable solution would be great.

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

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

发布评论

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

评论(1

耳钉梦 2024-12-18 15:35:52

AssemblyInfo.cs 文件虽然是一个类文件,但实际上并不包含任何类信息,默认情况下它只包含属性。您可以在这些属性周围使用条件编译符号:

#if MY_SYMBOL
[assembly: AssemblyTitle("Tim's Magical Application")]
#else
[assembly: AssemblyTitle("Some Other Name")]
#endif

您还可以使用自己的自定义属性< /a> 在那里。

但是该项目似乎只允许一个 assemblyinfo

文件驻留在项目的 Properties 文件夹中。您还可以在其旁边放置另一个 .cs 文件,其中包含另一个属性列表(即 AssemblyInfo.custom.cs)。您通过项目属性对话框更改的任何条目都会反映在原始 AssemblyInfo.cs 文件中,而您的自定义条目则保持不变。

因此,如果您决定使用 AssemblyInfo.cs 中的属性来控制客户特定的品牌,那么您有几种方法可以实现。就我个人而言,我会松散地打包一个中性图像,并使用我的构建过程或安装程序构建将适当的品牌图像包含在可分发包中(替换中性图像)。

The AssemblyInfo.cs file, while being a class file, doesn't actually have any class information in it, by default it simply contains attributes. You can use conditional compilation symbols around these attributes:

#if MY_SYMBOL
[assembly: AssemblyTitle("Tim's Magical Application")]
#else
[assembly: AssemblyTitle("Some Other Name")]
#endif

you can also use your own custom attributes in there.

But the project seems to only allow one assemblyinfo

This file resides in the Properties folder of the project. You can also have another .cs file sitting beside it with another list of attributes in it (i.e. AssemblyInfo.custom.cs). Any entries you change via the project properties dialog are reflected in the original AssemblyInfo.cs file, leaving your custom one untouched.

So if you decide to use attributes in the AssemblyInfo.cs to control the customer specific branding then you have a couple of ways to do it. Personally though I would have a neutral image loosely packaged, and use either my build process or installer build to include the appropriate branding images in the distributable package (replacing the neutral image).

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