msbuild脚本中的其他路径 [英] Additional paths in msbuild script

查看:467
本文介绍了msbuild脚本中的其他路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为MSBuild任务指定其他程序集引用路径?

How to specify additional assembly reference paths for the MSBuild tasks?

到目前为止,我有以下脚本,但无法确定如何指定其他搜索路径。

I have following script so far, but can't figure out how to specify additional search paths.

<ItemGroup>
 <ProjectsToBuild Include="..\Main\Main.sln" />
</ItemGroup>

<!-- The follwing paths should be added to reference search paths for the build tasks -->
<ItemGroup>
 <MyAddRefPath Include="$(MSBuildProjectDirectory)\..\..\Build\Lib1" />
 <MyAddRefPath Include="$(MSBuildProjectDirectory)\..\..\Build\Lib2" />
</ItemGroup>

<MSBuild
 Projects="@(ProjectsToBuild)"
 Properties="Configuration=Debug;OutputPath=$(BuildOutputPath)">
</MSBuild>

更新:

工作脚本,它调用原始项目,例如具有多个附加引用路径的SLN。

Please show one complete working script which invokes original project, such as an SLN with multiple additional reference paths.

没有关于如何改进项目结构的建议。
我知道如何建立一个好的结构,但现在是建立一个现有的垃圾的任务。

No suggestions on how to improve the project structure please. I know how to build a good structure, but now it's the task of building an existing piece of crap.

推荐答案

我已经决定了怎么做:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
    <ProjectsToBuild Include="ConsoleApplication1\ConsoleApplication1.csproj" />
</ItemGroup>

<ItemGroup>
    <AdditionalReferencePaths Include="..\Build\ClassLibrary1" />
    <AdditionalReferencePaths Include="..\Build\ClassLibrary2" />
</ItemGroup>

<PropertyGroup>
    <BuildOutputPath>..\Build\ConsoleApplication1</BuildOutputPath>
</PropertyGroup>

<Target Name="MainBuild">
    <PropertyGroup>
        <AdditionalReferencePathsProp>@(AdditionalReferencePaths)</AdditionalReferencePathsProp>
    </PropertyGroup>
    <MSBuild
        Projects="ConsoleApplication1\ConsoleApplication1.csproj"
        Properties="ReferencePath=$(AdditionalReferencePathsProp);OutputPath=$(BuildOutputPath)"
    >
    </MSBuild>
</Target>

这篇关于msbuild脚本中的其他路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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