Failed to load task "MSBuild.Community.Tasks.FileUpdate"

My definition of msbuild 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>

      

If several irrelevant lines have been omitted, focus on the relevant entries.

I have verified that "MSBuild.Community.Tasks.Targets" exist in MSBuildCommunityTasksPath

, but when I create a build target I get

The "MSBuild.Community.Tasks.FileUpdate" task could not be loaded from the assembly 

      

What could be the problem?

+4


source to share


1 answer


It might be too late to help the OP, but the same problem happened recently and it seems that by defining these two properties it started working: MSBuildCommunityTasksPath

and MSBuildCommunityTasksLib

.

So something like this should work:



  <PropertyGroup>
    <MSBuildCommunityTasksPath Condition=" '$(MSBuildCommunityTasksPath)' == '' ">$(ProjectDir)..\..\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
    <MSBuildCommunityTasksLib Condition=" '$(MSBuildCommunityTasksLib)' == '' ">$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
  </PropertyGroup>

  <Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.Targets" />
  <Target Name="Build">
    <FileUpdate Files="D:\test.js"
              Regex="(path)+.*?+(\\'.*?\\')"
              ReplacementText="Test" />
  </Target>

      

Using the attribute Condition

will help

0


source







All Articles