Задача CSC в Msbuild прерывается из-за ошибок пространства имен

Я попытался сделать следующее:

 <!-- 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. Проблема в том, что я получаю следующее:

What I get is that the command exits with Code 1? I want to get the project to build all the dependant dlls that it requires without having to open visual studio.

Любые идеи?

Спасибо :-)


person Community    schedule 22.09.2009    source источник


Ответы (1)


попробуйте это (добавьте свои собственные ссылки на 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>
person Gary    schedule 22.09.2009