Post build event not working with msbuild.exe
.net, asp.net, c#, msbuild
Solution
I have got it fixed by changing the Task to
<WriteLinesToFile File="$(OutDir)\VersionInfo.txt" ...... />
Problem
I have a post build event which is writing to a text file. It is working fine when I am building the project from Visual Studio. But when I am using msbuild.exe the Post build event is not writing to the file. I am using msbuild with following parameters: ``` msbuild.exe TestProj.Web.csproj /p:Configuration=Release /p:OutDir=C:\TestProj\bin\ /p:WebProjectOutputDir=C:\TestProj\ /p:DebugSymbols=false /p:DebugType=None ``` The post build event looks like: ``` <PropertyGroup Condition="'$(BUILD_NUMBER)'==''"> <COMPUTERNAME>None</COMPUTERNAME> <BRANCH>None</BRANCH> <BUILD_NUMBER>None</BUILD_NUMBER> </PropertyGroup> <Target Name="AfterBuild"> <WriteLinesToFile File="$(ProjectDir)$(OutputPath)\VersionInfo.txt" Overwrite="true" Lines="Project
Created On $(COMPUTERNAME)
Branch is $(BRANCH)
Version Is $(BUILD_NUMBER)" /> </Target> ```