有没有一种方法可以在Visual Studio项目中进行特定于用户的事前/事后构建事件? [英] Is there a way to make user specific pre/post build events in Visual Studio projects?

查看:82
本文介绍了有没有一种方法可以在Visual Studio项目中进行特定于用户的事前/事后构建事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我的项目中使用一个post build事件将我的程序集复制到另一个目录中,以进行调试.这是我的计算机本地的,并且仅用于调试目的,因此,我希望将其保存在* .csproj.user 文件中,而不是* .csproj 文件中.我尝试将负责任的元素从* .csproj 复制到* .csproj.user ,但这没用.

I'm currently using a post build event in my project to copy my assemblies to another directory for debugging purposes. This is local to my machine, and is for debugging purposes only, so I would prefer to have it in a *.csproj.user file instead of a *.csproj file. I tried copying the responsible elements from the *.csproj to the *.csproj.user, but that didn't work.

修改 为了澄清,我不想将用户特定的命令放在* .csproj 文件的构建后事件中.相反,我想将构建后事件命令放在* .csproj.user 文件中. (从目前的答案来看,这看起来是不可能的)

Edit To clarify, I do not want to put user specific commands in the post-build event in the *.csproj file. Instead, I want to put the post-build event commands in the *.csproj.user file. (From the answers so far, this is looking impossible)

要提供更多背景信息,这不是项目参考.我将程序集复制到在运行时加载程序集的应用程序目录中. (考虑插件)

To give more context, it is not a project reference. I am copying my assembly to the directory of the application that loads the assemblies at runtime. (Think plugins)

推荐答案

简短的答案是否",而不是您想要的方式:|

The short answer is no, not the way you want to do it :|

稍长的答案是sorta.从理论上讲,您可以为个别用户触发特定的构建事件,但是这些事件仍将存在于csproj文件中.您可以在内部版本上运行外部事件,然后根据哪些用户在运行这些外部事件(作为脚本)来运行这些外部事件.

The slightly longer answer is sorta. You can in theory have specific build events triggered for individual users, but these would still be in the csproj file. You can run external events on builds and then allow these external events to run depending on what user is running them (as a script).

如果这仅是为了调试,我只需要插入它们,在将其上载到版本控制系统之前,先完成您的构建工作并将其拉出.

If this is for debug only I'd just insert them, do your build stuff and pull them out before uploading it to your version control system.

这篇关于有没有一种方法可以在Visual Studio项目中进行特定于用户的事前/事后构建事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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