的MSBuild,包括基于一组路径的文件 [英] MSBuild, include files based on a group of paths

查看:331
本文介绍了的MSBuild,包括基于一组路径的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建构建脚本,可以让我指定的包含在某个特定网站的路径为模块项目列表。

I'm trying to create a build script which would allow me to specify a list of paths to "module projects" that is included in a specific web site.

因此​​,我有这样的布局:

Hence, I have this layout:

customer folder
    |_MainProject
    |_ModuleProject1
    |_ModuleProject2

所以,基本上我希望能够指定将包含ModuleProject1和2,并从中复制相关的文件到MainProject一个的ItemGroup。

So, basically I want to be able to specify an ItemGroup that would contain ModuleProject1 and 2, and copy relevant files from it into the MainProject.

<ItemGroup>
  <CustomModule Include="ModuleProject1\*.csproj" />
  <CustomModule Include="ModuleProjec2\*.csproj" />
</ItemGroup>

在我的主要构建脚本然后,我想找出驻留项目的OBJ \\发布的* .dll文件夹中的路径,以我的附属程序,以及所有的DLL。

In my main build script I then want to find out the paths to my satellite assemblies, as well as all dlls that reside inside the obj\Release*.dll folder of the project.

我已经有项目组对项目文件(.csproj),所以基本上我只是想添加一些更多的文件引用。但我想不出我会怎么做。这就是我今天:

I already have item groups for the project file (.csproj), so basically I just want to add some more file references. But I can't figure out how I would do that. This is what I have today:

<Satellites Include="$(ReferencesFolder)\??\*.dll" />
<Satellites Include="$(SiteRoot)\bin\??\*.dll" />
<Satellites Include="%(CustomModule.RelativeDir)obj\$(Configuration)\??\*.dll" />

我将如何着手制定基于我有事实的最后一行的工作?

How would I go about making the last line work based on the facts that I have?

在做这个:

<Message Text="%(CustomModule.RelativeDir)obj\$(Configuration)\??\*.dll" />

据输出这样的:

ModuleProject1\obj\Release\??\*.dll
ModuleProject2\obj\Release\??\*.dll

和如果任何人有一些链接的MSBuild具有很好的例子,我真的AP preciate它的基本面。我总是在MSDN结束了一些非常神秘的例子并不真正解释了很多东西。

And if anyone has some links to the fundamentals of MSBuild with good examples, I would really appreciate it. I always end up at msdn with some really cryptic examples that doesn't really explain a lot.

编辑:我修改了我的计划,几乎有工作,但是因为包括我期望它并没有真正的工作。没有被包括,但也有文件mathing路径

I revised my plan and almost have it working, however the include doesn't really work as I expect it to. Nothing is included, but there are files mathing the path.

如果我手动补充一点:

<Satellites Include="ModuleProject1\obj\Release\??\*.dll" />

它实际上是包含在卫星项目小组。

It is actually included in the "Satellites" item group.

推荐答案

找到了解决办法我自己,好像我需要一个解决方法是明确工作。

Found a solution myself, seems like I needed a workaround for it to work explicitly.

由于我没有能够根据另一个项目名单上包括的项目,这是我终于想出了:

Since I wasn't able to include items based on another item list, this was what I finally came up with:

<Target Name="BuildModules">
    <!-- We do this because we need a property with the correct wildcards, otherwise it won't work -->
    <PropertyGroup>
        <CustomModuleSatellites>@(CustomModule->'%(RelativeDir)obj\$(Configuration)\??\*.dll')</CustomModuleSatellites>
    </PropertyGroup>
    <ItemGroup>
        <Satellites Include="$(CustomModuleSatellites)" />
    </ItemGroup>
</Target>

我需要一个目标中创建一个属性(它外面没有会飞,是因为它仍然包含了外卡),然后使用该财产TI包括使用通配符在我的项目列表中的文件,否则这将是在它和通配符的路径,然后copy命令也不能工作。

I needed to create a property within a Target (outside of it it didn't fly because it still contained the wild cards), and then use that property ti include the files using wildcards in my item list, otherwise it would be paths with wildcards in it and then the copy command didn't work either.

这篇关于的MSBuild,包括基于一组路径的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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