0

私は次のことを試みました:

 <!-- Specify the inputs by type and file name -->
<ItemGroup>
    <CSFile Include = "$(MSBuildProjectDirectory)\..\Mine.cs"/>
</ItemGroup>

<Target Name = "Compile">
    <!-- Run the Visual C# compilation using input files of type CSFile -->
       <Csc Sources="@(CSFile)" />
    <!-- Log the file name of the output file -->
    <Message Text="The output file is done"/>
</Target>

プロジェクトで使用されるすべての名前空間がエラーをスローするため、これは機能しません。パスは問題なく、Visual Studioにロードされていればすべて問題ないため、ソリューションファイルからアセンブリを明示的に取得する方法を知っている人はいますか?これをスクリプト化する必要がありますが、上記は機能しません。明らかな事故はありますか?

入力に感謝します:-)

私が持っているファイルにはいくつかの外部依存関係があるため、これは機能しないことに気づきました。したがって、devenv.exeを使用する必要があります。問題は、私が次のことを理解していることです。

私が得たのは、コマンドがコード1で終了するということですか?Visual Studioを開かなくても、プロジェクトで必要なすべての依存dllをビルドできるようにしたいと思います。

何か案は?

Thnxes :-)

4

1 に答える 1

0

これを試してください(独自のdll参照を追加してください)

<ItemGroup>
  <CSFile Include = "$(MSBuildProjectDirectory)\..\Mine.cs"/>
  <Reference Include="System.dll"/>
  <Reference Include="System.Data.dll"/>
  <Reference Include="System.Drawing.dll"/>
  <Reference Include="System.Windows.Forms.dll"/>
  <Reference Include="System.XML.dll"/>
</ItemGroup>
<Target Name = "Compile">
    <!-- Run the Visual C# compilation using input files of type CSFile -->
       <Csc Sources="@(CSFile)" 
            References="@(Reference)"
            OutputAssembly="$(builtdir)\$(MSBuildProjectName).exe"
            TargetType="exe" />
            />
    <!-- Log the file name of the output file -->
    <Message Text="The output file is done"/>
</Target>
于 2009-09-22T19:20:12.903 に答える