为多个文件创建一个 msbuild
Create a msbuild for multiple files
我写了一个用于编译多个文件的文件,但它不起作用。
<项目 xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Compile">
<物品组>
<FilesToCompile Include="hola.cs"/>
<FilesToCompile Include="hola2.cs"/>
</项目组>
<属性组><br>
<程序集名称>Proyecto</程序集名称>
<OutputPath>Bin\</OutputPath><br>
<优化>假</优化>
</物业组>
<目标名称="Compile">
<MakeDir 目录="$(OutputDir)"/>
<Csc Sources="@(FilesToCompile)" OutputAssembly="$(OutputPath)$(AssemblyName)" Optimize="$(Optimize)" TargetType="exe" />
</目标>
</项目>
它告诉我这个错误。
enter image description here
英文:
error CS0017: Program 'output file name' has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
我自己解决了
<Project DefaultTargets = "Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<PropertyGroup>
<NombreClase1>hola1</NombreClase1>
<NombreClase2>hola2</NombreClase2>
</PropertyGroup>
<ItemGroup>
<Clase1 Include = "hola.cs"/>
<Clase2 Include = "hola2.cs"/>
</ItemGroup>
<Target Name = "Compile">
<CSC Sources = "@(Clase1)" OutputAssembly = "$(NombreClase1).exe">
<Output TaskParameter = "OutputAssembly" ItemName = "Ejecutable1" />
</CSC>
<Message Text="Archivo compilado @(Ejecutable1)"/>
<CSC Sources = "@(Clase1)" OutputAssembly = "$(NombreClase2).exe">
<Output TaskParameter = "OutputAssembly" ItemName = "Ejecutable2" />
</CSC>
<Message Text="Archivo compilado @(Ejecutable2)"/>
</Target>
</Project>
我写了一个用于编译多个文件的文件,但它不起作用。
<项目 xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Compile">
<物品组>
<FilesToCompile Include="hola.cs"/>
<FilesToCompile Include="hola2.cs"/>
</项目组>
<属性组><br>
<程序集名称>Proyecto</程序集名称>
<OutputPath>Bin\</OutputPath><br>
<优化>假</优化>
</物业组>
<目标名称="Compile">
<MakeDir 目录="$(OutputDir)"/>
<Csc Sources="@(FilesToCompile)" OutputAssembly="$(OutputPath)$(AssemblyName)" Optimize="$(Optimize)" TargetType="exe" />
</目标>
</项目>
它告诉我这个错误。 enter image description here
英文:
error CS0017: Program 'output file name' has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
我自己解决了
<Project DefaultTargets = "Compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<PropertyGroup>
<NombreClase1>hola1</NombreClase1>
<NombreClase2>hola2</NombreClase2>
</PropertyGroup>
<ItemGroup>
<Clase1 Include = "hola.cs"/>
<Clase2 Include = "hola2.cs"/>
</ItemGroup>
<Target Name = "Compile">
<CSC Sources = "@(Clase1)" OutputAssembly = "$(NombreClase1).exe">
<Output TaskParameter = "OutputAssembly" ItemName = "Ejecutable1" />
</CSC>
<Message Text="Archivo compilado @(Ejecutable1)"/>
<CSC Sources = "@(Clase1)" OutputAssembly = "$(NombreClase2).exe">
<Output TaskParameter = "OutputAssembly" ItemName = "Ejecutable2" />
</CSC>
<Message Text="Archivo compilado @(Ejecutable2)"/>
</Target>
</Project>