Build All projects in a directory

可紊 提交于 2019-12-11 03:07:59

问题


Im try to build my plugins that sit in a seperate directory on the root.

  <ItemGroup>
    <PluginProjectFiles Include="$(MSBuildStartupDirectory)..\..\Plugins\**\*.csproj"/>
  </ItemGroup>
  <Target Name="BuildPlugins">
    <MSBuild Projects="@(PluginProjectFiles)" Targets="Clean;Build" Properties="Configuration=Release" />
    <Message Text="Dir: $(MSBuildStartupDirectory)" />
  </Target>

Although im having problems. My build runs the 'BuildPlugin' Target but it doesn't build my project files. I really don't want to have to build each project separately if I can avoid it.

Any ideas would be great. Thanks,


回答1:


Please refer to my resolution below.

  <PropertyGroup>
    <SrcFolder>$(MSBuildProjectDirectory)\..\..</SrcFolder>
  </PropertyGroup>
  <ItemGroup>
    <PluginProjectsFiles Include="$(SrcFolder)\Plugins\Plugin.*\*.csproj" />
  </ItemGroup>
  <Target Name="BuildPlugins">
    <Message Text="Building Plugins" />
    <MSBuild Projects="@(PluginProjectsFiles)" Targets="Clean;Build" Properties="Configuration=Release" />
    <Message Text="Plugins Built" />
  </Target>

I then changed my DependsOnTargets attribute on my primary build target to my 'BuildPlugins' target. Hope this helps someone as this cause me considerable pain.



来源:https://stackoverflow.com/questions/9865641/build-all-projects-in-a-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!