My msbuild definition looks like this:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildCommunityTasksPath>..\..\..\..\_Packages\MSBuildTasks.1.5.0.235\tools</MSBuildCommunityTasksPath>
</PropertyGroup>
<Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.Targets" />
<Target Name="Build">
<FileUpdate Files="D:\test.js"
Regex="(path)+.*?+(\\'.*?\\')"
ReplacementText="Test" />
</Target>
</Project>
Where several irrelevant lines have been left out, to focus on the relevant entries.
I verified that 'MSBuild.Community.Tasks.Targets' exist at the MSBuildCommunityTasksPath
, but when I generate the build target, I get
The "MSBuild.Community.Tasks.FileUpdate" task could not be loaded from the assembly
What could be the problem?
Probably too late to help OP, but recently had the same problem and it seems that by defining these two properties it started working:
MSBuildCommunityTasksPath
andMSBuildCommunityTasksLib
.So something like this should work:
The use of the
Condition
attribute will help avoid collisions (e.g. if you have more than one target file that defines those properties)