質問

通常のSLNファイルがあり、コマンドラインからmsbuildで問題なくコンパイルしています。これを行います:

C:\ slndir> msbuild / p:OutDir = C:\ slnbin \

そして、C:\ slnbin_PublishedWebsites \に展開されるWebサイトを除くすべてをC:\ slnbinにダンプします。

私が望むのは、すべてのバイナリをbinディレクトリにドロップするだけでなく、各実行可能プログラムに独自の「デプロイ済み」を持たせることです各ウェブサイトが取得するものと同様のフォルダ。

たとえば、次のプロジェクトがある場合:  - 一般  -Lib1  -サービス1  -Lib2  -Service2

入手したい:

  C:\slnbin\ // Everything
  C:\slbin\Deploy\Service1 // Common, Lib1, Service1
  C:\slbin\Deploy\Service2 // Common, Lib2, Service2

" msbuild / p:OutDir = C:\ slnbin \ $(ProjectName)"のようなことを試みましたが、それをリテラルとして扱い、実際の" $(ProjectName)"を作成します。サブディレクトリ。

できれば、個々のプロジェクトなどを修正する必要はないでしょう。

これは可能ですか?簡単ですか?

役に立ちましたか?

解決

John Saundersが言ったように、プロセスを処理するマスターMSBuildファイルが必要です。

MSBuildコミュニティタスクを使用したサンプル:プロジェクトを取得する GetSolutionProjects 特定のソリューションに対して

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Package">

  <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

  <!-- Specify here, the solution you want to compile-->
  <ItemGroup>
    <Solution Include="C:\slndir\solution.sln"/>
  </ItemGroup>

  <PropertyGroup>
    <Platform>AnyCPU</Platform>
    <Configuration>Debug</Configuration>

    <!-- Your deployment directory -->
    <DeployDir>C:\slbin\Deploy</DeployDir>
  </PropertyGroup>

  <!-- Gets the projects composing the specified solution -->
  <Target Name="GetProjectsFromSolution">
    <GetSolutionProjects Solution="%(Solution.Fullpath)">
      <Output ItemName="ProjectFiles" TaskParameter="Output"/>
    </GetSolutionProjects>
  </Target>

  <Target Name="CompileProject" DependsOnTargets="GetProjectsFromSolution">
    <!-- 
      Foreach project files
        Call MSBuild Build Target specifying the outputDir with the project filename.
    -->
    <MSBuild Projects="%(ProjectFiles.Fullpath)"
             Properties="Platform=$(Platform);
             Configuration=$(Configuration);
             OutDir=$(DeployDir)\%(ProjectFiles.Filename)\"
             Targets="Build">
    </MSBuild>
  </Target>
</Project>

他のヒント

「手動で」これを行う必要があります。ソリューションをビルドするマスターMSBUILDプロジェクトファイルを作成し、すべてのソリューション出力を必要な場所にコピーします。これは(大体)Visual Studio Team Buildが行う方法です。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top