I am working with MSBuild (version v4.0.30319 - 32-bit version) on Windows 2008 x64. I wanted to understand how MSBuild manages built-in tasks. Will it compile once per task call? Or will it compile once and reuse for each task call?
I started MSBuild with the argument "/ m" and tried to introduce a deliberate error into the C # code. And MSBuild pointed me to 1 text file (under the temp folder somewhere in my profile folder). No other text file has been created. However, I did not know how to understand this if there were no errors.
My intention is to try to understand this: To find out if it will be effective for the same order as the compiled dll (instead of the built-in task). The minimum overhead for compiling the embedded task code is acceptable if the compilation is performed only once (because I will save on the SCM aspects of the code and binary files).
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="default" ToolsVersion="4.0"> <Target Name="default"> <ItemGroup> <A Include="1;2;3;4;5;6;7;8;9;10"/> </ItemGroup> <MSBuild Projects="$(MSBuildProjectFullPath)" BuildInParallel="true" Targets="Echoer" ToolsVersion="4.0" StopOnFirstFailure="true" Properties="Prop=%(A.Identity)"/> </Target> <Target Name="Echoer"> <MyTask WhatToEcho="$(Prop)"/> </Target> <UsingTask TaskName="MyTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> <ParameterGroup> <WhatToEcho ParameterType="System.String" Required="True"/> </ParameterGroup> <Task> <Code Language="cs" Type="Fragment"> <![CDATA[ Log.LogMessage("Property received: "+WhatToEcho); ]]> </Code> </Task> </UsingTask> </Project>
source share