如何在解决方案构建过程中以编程方式获取程序集名称? [英] How to get assembly name programmitcally during solution build?

查看:87
本文介绍了如何在解决方案构建过程中以编程方式获取程序集名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图弄清楚如何在使用C#的构建过程中获得每个项目的程序集名称.到目前为止,我有一个 AddIn ,它可以查看何时构建项目以及何时构建解决方案.示例代码:

I have been trying to figure out how to get the assembly name for each project during a build using C#. So far I have a AddIn that can see when projects are built and when the solution is built. Example code:

// Retrieve the event objects from the automation model.
EnvDTE.Events events = _applicationObject.Events;
buildEvents = events.BuildEvents;
buildEvents.OnBuildDone += new_dispBuildEvents_OnBuildDoneEventHandler(buildEvents_OnBuildDone);
buildEvents.OnBuildProjConfigDone += new _dispBuildEvents_OnBuildProjConfigDoneEventHandler(buildEvents_OnBuildProjConfigDone);


我到处环顾四周,看看是否可以找到方法,但没有发现任何东西.

我想做的是将DLL列表发送给以管理员身份运行的另一个进程.接收DLL列表的应用程序将为COM/tlb注册它们,然后将它们放入Global Assembly Cache.

因此,我无法以管理员身份连接到我的源代码管理,这是进行单独处理的原因.

有任何想法吗?


I have looked all over the place to see if I could find out how to do this but have not found anything.

What I am trying to do is send a list of DLLs to another process that is running as an Administrator. The application that receives the list of DLLs will then register them for COM /tlb and then put them into the Global Assembly Cache.

I cannot connect to my source control as an Admin thus, the reason for the separate process.

Any ideas? Thanks!

推荐答案

不是一个对您的方法有所帮助的想法,但是为什么不为此使用NANT构建脚本.它为您完成了所有这些工作.
Not an idea which will help with your approach, but why don''t use a NANT build script for this. It does all that sort of thing for you..


您确实在以错误的方式进行操作.

您可以使用csproj设置中的pre和post生成部分来更轻松地做到这一点.

例如,我用
You really are going about this the wrong way.

You can use the pre and post build sections in your csproj settings to do this more easily.

For example I do my gacutil.exe stuff with the built in properties like


(TargetPath)等内置属性来处理gacutil.exe内容.

只要走到那里,您就会发现各种属性,可以帮助您在构建中创建非常有趣的前后步骤.
(TargetPath) etc.

Just go there and you will find all sorts of properties to help you create really interesting pre and post steps in your build.


这篇关于如何在解决方案构建过程中以编程方式获取程序集名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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