User Tools

Site Tools


notes:tools:msbuild

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
notes:tools:msbuild [2018/11/29]
leszek
notes:tools:msbuild [2018/11/29] (current)
leszek
Line 399: Line 399:
 ZipFilesTarget:​ ZipFilesTarget:​
   Creating ZipFile: files.zip   Creating ZipFile: files.zip
 +</​code>​
 +
 +Example: Remove an output folder and build a VS solution:
 +<code xml>
 +<Project DefaultTargets="​BuildSolution"​ Sdk="​Microsoft.NET.Sdk">​
 +    <​PropertyGroup>​
 +        <​OutputType>​Exe</​OutputType>​
 +        <​TargetFramework>​netcoreapp2.0</​TargetFramework>​
 +        <​OutputPath>​$(MSBuildThisFileDirectory)Output</​OutputPath>​
 +        <​SolutionFileName>​C:​\Projects\DoSomething.sln</​SolutionFileName>​
 +    </​PropertyGroup>​
 +
 +    <Target Name="​CleanDir">​
 +        <​RemoveDir Directories="​$(OutputPath)"​ Condition="​Exists($(OutputPath))"​ />
 +    </​Target>​
 +
 +    <Target Name="​BuildSolution"​ DependsOnTargets="​CleanDir">​
 +        <MSBuild Projects="​$(SolutionFileName)"​
 +                 ​Properties="​Configuration=Release;​OutputPath=$(OutputPath)"​ />
 +    </​Target>​
 +</​Project>​
 </​code>​ </​code>​
  
notes/tools/msbuild.txt ยท Last modified: 2018/11/29 by leszek