【问题标题】:How to tell MSBuild where to put my compiled files?如何告诉 MSBuild 将我的编译文件放在哪里?
【发布时间】:2009-12-13 03:57:57
【问题描述】:

我正在尝试使用 Nant 编译 ASP.NET MVC 应用程序,到目前为止,我的构建脚本只运行 ms build 并运行一些其他任务,但是我希望将编译后的文件放在“build”目录中,如何告诉 msbuild 将编译后的文件放在哪里?

【问题讨论】:

    标签: asp.net-mvc msbuild nant


    【解决方案1】:

    看这里:

    http://msdn.microsoft.com/en-us/library/ms164311.aspx

    它指定您可以设置 msbuild 以覆盖项目文件中的输出目录设置,如下所示:

    /properties:OutputDir=bin\Debug
    

    这是你想要的吗?

    【讨论】:

      【解决方案2】:

      你可以把它放在你的项目文件中(或者如果你想重用,也可以放在导入的项目文件中),它将覆盖可执行文件/dll的路径和.obj文件等的路径。

      <PropertyGroup>
        <OutputPath>c:\bin</OutputPath>
        <BaseIntermediateOutputPath>c:\temp\$(AssemblyName)</BaseIntermediateOutputPath>
      </PropertyGroup>
      

      【讨论】:

        【解决方案3】:

        如果您使用的是来自 NAntContrib 的 任务,那么您可以像这样设置 OutputDir 属性:

        <msbuild project="path-to-sln-or-csproj-or-msbuild" target="Build">
          <properties>
            <property name="OutputDir" value="build-outdir-dir" />
          </properties>
        </msbuild>
        

        【讨论】:

        • 这个答案是七年前的。我希望我在实际项目中使用过它,但我不记得了。自从我写这个答案以来,NAntContrib 中的某些东西也可能改变了行为。
        猜你喜欢
        • 2014-01-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-02-02
        相关资源
        最近更新 更多