Wednesday, January 4, 2017

Sitecore Team Development Server - We can only call this method once error when building

I was editing my .user for my TDS.Master project when I started getting this error when building:


Error 16 The build was aborted because of an internal failure. Microsoft.Build.BuildEngine.Shared.InternalErrorException: Internal MSBuild Error: We can only call this method once at Microsoft.Build.BuildEngine.Engine.EngineBuildLoop(BuildRequest terminatingBuildRequest) at Microsoft.Build.BuildEngine.Engine.PostProjectEvaluationRequests(Project project, String[] projectFiles, String[][] targetNames, BuildPropertyGroup[] globalPropertiesPerProject, IDictionary[] targetOutputsPerProject, BuildSettings buildFlags, String[] toolVersions) 0 1 TDS.Master


The error occurred for each TDS project, not just the master one.

It occurred when adding a new Replacement node under a fairly new Build Configuration named DevCD. I undid my change, but the error remained. I switched my active Configuration to one named Debug and it compiled correctly. I added the new line to Debug, and the error showed up when building under that configuration. I removed the line from Debug and the error stayed!

<ItemGroup Condition=" '$(Configuration)' == 'DevCD' ">
  <Replacement Include="..\PATH\">
     <TargetPath>e:\PATH\</TargetPath>
     <IsFolder>True</IsFolder>
    <IsRelative>True</IsRelative>
  </Replacement>

I tried re-running the installer for TDS with the repair option, opening and closing Visual Studio, but nothing seemed to help.

What finally fixed it was to go into the TDS project settings and checked the "Edit user specific configuration (.user file) under Build. It re-wrote the .user file and everything worked again. I did a compare and the only thing that changed were line breaks and spacing - but the error went away. It doesn’t matter which Configuration is selected, since the .user file contains the settings from all.


FYI - when going back into settings, the check box will always be unchecked by default and checking it will re-create your file.