简体   繁体   English

有没有一种方法可以在IDE中的解决方案中执行所有项目的目标(无命令行)?

[英]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.

相关问题 有没有办法修改解决方案中的所有项目? - Is there a way to revision all projects in a solution? 在 Visual Studio 解决方案中更改我所有项目的目标框架 - Change the Target Framework for all my projects in a Visual Studio Solution 您可以搜索解决方案中的当前项目和所有引用的项目吗? - Can you search in current project and all referenced projects within solution? 在VS中生成其他解决方案项目的MSBuild任务失败,但可与MSBuild.exe命令行一起使用 - MSBuild task to Build other solution projects fails in VS but works with MSBuild.exe command line 从代码获取解决方案中的项目列表 - get list of projects within solution from code Visual Studio 未在解决方案中显示所有项目 - Visual Studio not showing all Projects in solution 如何从VS IDE执行自定义PublishOnly目标 - How to execute a custom PublishOnly target from VS IDE 在解决方案中构建多个项目之前如何执行流程 - How to execute process before build multiple projects in a solution 如何使用命令行MSTest.exe在我的解决方案中运行所有测试? - How to run ALL tests in my solution using command line MSTest.exe? 如何在Visual Studio 2010解决方案中调试多个项目 - How to debug multiple projects within a Visual Studio 2010 solution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM