I am very new to MSBuild. I am attempting two different paths toward a solution. Test is giving me errors and Compile is working but I’m not even sure if it does anything.
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Debug</Configuration>
<AssemblyName>MSBuildSample</AssemblyName>
<OutputPath>Output\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<Reference Include="**\*.dll"/>
</ItemGroup>
<ItemGroup>
<ProjectsToBuild Include="**\*proj" Exclude="$(MSBuildProjectFile)"/>
</ItemGroup>
<Target Name="Test">
<MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" />
<Csc Sources="@(Compile)" References="@(Reference)" OutputAssembly="$(OutputPath)$(AssemblyName).exe" />
<Message Text="The output file is done"/>
</Target>
<Target Name="Clean">
<MSBuild Projects="@(ProjectsToBuild)" ContinueOnError="false" Targets="Clean"
Properties="Configuration= $(Configuration)" />
</Target>
<Target Name="Compile" DependsOnTargets="Clean">
<MSBuild Projects="@(ProjectsToBuild)" ContinueOnError="false" Properties="Configuration=$(Configuration)">
<Output ItemName="BuildOutput" TaskParameter="TargetOutputs"/>
</MSBuild>
</Target>
</Project>
Am I headed down the right path at all?
You can simply pass a solution file as project to the
MSBuildtask:OR
If this is not a case for you please let me know
EDIT: Answer to comments
From MSDN, MSBuild Task:
MSBuilddoes NOT create solution files. Considering you have a solution file which includes both projects you’ve mentioned – you can just specify single solution file and MSBuild pickup all projects which are included.Perhaps you need this one:
How to: Create Solutions and Projects