hi i am new to ms build scripting i have written a simple script to build my application
<ItemGroup>
<FilesToCompile Include="Form1.cs" />
<FilesToCompile Include="Form1.Designer.cs" />
<FilesToCompile Include="Program.cs" />
<FilesToCompile Include="Properties\AssemblyInfo.cs" />
<FilesToCompile Include="Properties\Resources.Designer.cs" />
<FilesToCompile Include="Properties\Settings.Designer.cs" />
</ItemGroup>
<ItemGroup>
<ResourceFiles Include="Properties\Resources.resx" />
</ItemGroup>
<PropertyGroup>
<OutputDir>bin\debug</OutputDir>
<OutputAssembly>$(OutputDir)\TestHelloAuto.exe</OutputAssembly>
<Optimize>false</Optimize>
</PropertyGroup>
<Target Name="Build">
<Message Text="build MSbuild project file from scratch" />
<MakeDir Directories="$(OutputDir)"/>
<GenerateResource Sources="@(ResourceFiles)">
<Output TaskParameter="OutputResources" ItemName="CompiledResources"/>
</GenerateResource>
<Csc Sources="@(FilesToCompile)" OutputAssembly="$(OutputAssembly)" Optimize="$(Optimize)" TargetType="exe"
Resources="@(CompiledResources)"/>
</Target>
my issue is that by default the "exe" that is created is of the output type Console application and opens a console when i run the exe. how can i change the output type of the application through the script to "Windows application" this happens even though i have my output type set as windows application through visual studio IDE. any help will be much appreciated.
Assuming you don't have an IDE to change this for you, inside your <PropertyGroup>
element you can change the output assembly type to what you expect by adding another XML node: <OutputType>WinExe</OutputType>