[英]Is there a way to execute a target for all projects in a solution within the IDE (no command line)?
Please hear me out as this question has been modified extensively. 请听我说,因为这个问题已被广泛修改。
I have an msbuild target that I want to execute after each project in my solution is built from the IDE. 我有一个要通过IDE构建解决方案中的每个项目之后执行的msbuild目标。 I can easily do this by creating an msbuild replica of my solution, but you can't use it within visual studio. 我可以通过创建解决方案的msbuild副本轻松地做到这一点,但是您不能在Visual Studio中使用它。 You can go through the projects properies as specify an after build process, but this is quite tedious, especially if you have more than 2 projects. 您可以按照指定的构建后流程来检查项目属性,但这非常繁琐,尤其是如果您有两个以上的项目。
Is there a better way to execute a target for all projects in a solution within the IDE? 在IDE中的解决方案中,是否有更好的方法可以为所有项目执行目标? I just can't believe that VS2010 doesn't give you an easier option. 我简直不敢相信VS2010不会给您一个更简单的选择。
BTW, does VS 2012 Beta support a full MsBuild file instead of the brain dead solution file? 顺便说一句,VS 2012 Beta是否支持完整的MsBuild文件而不是“脑残”解决方案文件?
What I get from your question is that you've extended the build process and then created a 'shadow' msbuild file that does what the solution file normally ends up doing during build. 我从您的问题中得到的是,您已经扩展了构建过程,然后创建了一个“影子” msbuild文件,该文件可以执行解决方案文件通常在构建过程中完成的工作。 As you are aware, solution files are a rather unfortunate visual studio only concept. 如您所知,解决方案文件是一个非常不幸的Visual Studio专用概念。 That issue is nearly impossible to work around. 这个问题几乎不可能解决。
The idiomatic approach to this problem is leave the solution file alone and modify the individual .csproj files to include the custom build steps that each project would need to be completed according to your process. 解决此问题的惯用方法是将解决方案文件保留下来,并修改各个.csproj文件,以包括每个项目都需要根据您的过程完成的自定义生成步骤。 NuGet does this when you use it, so does NotifyPropertyWeaver. 使用时,NuGet会这样做,NotifyPropertyWeaver也是如此。 (NuGet works around the solution issue by introducing a '$(SolutionDir)' property) (NuGet通过引入'$(SolutionDir)'属性来解决解决方案问题)
As an aside, I'm not sure how valuable 'building an installer' is to the individual developer on your team and including in the build seems like it adds friction rather than removes it. 顺便说一句,我不确定“构建安装程序”对您团队中的单个开发人员有多重要,并且包括在构建中似乎会增加摩擦而不是消除摩擦。
If this is for a custom build server, there's no need to use the solution file at all if you don't mind keeping the two in sync and I'd wholeheartedly recommend that approach. 如果这是针对定制构建服务器的,那么如果您不介意使两者保持同步,则根本不需要使用解决方案文件,我将全力推荐该方法。
You can debug msbuild using the visual studio IDE. 您可以使用Visual Studio IDE调试msbuild。 There is an undocumented registry switch to enable. 有一个未记录的注册表开关要启用。 See this thorough msdn article: http://blogs.msdn.com/b/visualstudio/archive/2010/07/06/debugging-msbuild-script-with-visual-studio.aspx 参阅这篇详尽的msdn文章: http : //blogs.msdn.com/b/visualstudio/archive/2010/07/06/debugging-msbuild-script-with-visual-studio.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.