Project Doesn't Build After Installed Sitecore TDS

658 Views Asked by At

After setting up Sitecore TDS, my project will not build. I'm new to Visual Studio and also new to working with Sitecore. It seems that it cannot find a particular setting, but a Google search is not coming up with anything:

Severity    Code    Description Project Path    File    Line    Suppression State
Error       The "AnalyzeProject" task failed unexpectedly.
System.MissingFieldException: Field not found: 'HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo.ParsedItem'.
   at HedgehogDevelopment.SitecoreProject.Analysis.TemplateStructure.Validate(Dictionary`2 projectItems, XDocument scprojDocument)
   at HedgehogDevelopment.SitecoreProject.Tasks.ProjectAnalysis.AnalysisEngine.<>c__DisplayClass4_1.<GetReport>b__0()
   at HedgehogDevelopment.SitecoreProject.Tasks.ProjectAnalysis.ExecutionTimer.Time(Action action)
   at HedgehogDevelopment.SitecoreProject.Tasks.ProjectAnalysis.AnalysisEngine.GetReport(Dictionary`2 projectItems, XDocument scprojDocument)
   at HedgehogDevelopment.SitecoreProject.Tasks.AnalyzeProject.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() B2B.Core    C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0 C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets 144 

Apparently my project does still build and will run, but that error pops up each time regardless.

1

There are 1 best solutions below

0
On

This can happen when you have TDS validations enabled and are missing some DLLs.

In this directory:

C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0\

Add the following DLLs:

  • Microsoft.Web.Infrastructure.dll
  • TDSWebDeploy.Services.Contracts.dll

If you have TDS installed, you may be able to source those DLLs from somewhere in your C:\Program Files (x86)\MSBuild\HedgehogDevelopment directory. If not, someone else on your team may have them.

You can also try disabling and enabling validations by right clicking your TDS project --> Properties --> Validations tab.

I have seen this issue on numerous occasions across numerous dev boxes. We have opened support tickets regarding it, but no conclusions were drawn.

The specific error is that the HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo.ParsedItem field is missing on an object. The fact that ParsedItem is mentioned implies that some form of parsing may be occurring, and that it didn't work as expected. This is conjecture, but if parsing is occurring, it would be worth ensuring that your serialized item files are accessible to the user/group that is performing this parsing.

Here is the code that is failing:

public override IEnumerable<Problem> Validate(Dictionary<Guid, SitecoreDeployInfo> projectItems, XDocument scprojDocument)
{
    List<Problem> problems = new List<Problem>();
    foreach (KeyValuePair<Guid, SitecoreDeployInfo> projectItem in projectItems)
    {
        // ** Presumably, it's failing here **
        string item = projectItem.Value.ParsedItem.Properties["template"];
        if (string.IsNullOrEmpty(item))
        {
            continue;
        }
        Guid guid = new Guid(item);
        if (guid == TemplateStructure.TEMPLATE)
        {
            problems.AddRange(this.ValidateTemplate(projectItems, projectItem.Value.Item));
        }
        else if (guid != TemplateStructure.TEMPLATE_SECTION)
        {
            if (guid != TemplateStructure.TEMPLATE_FIELD)
            {
                continue;
            }
            problems.AddRange(this.ValidateField(projectItems, projectItem.Value.Item));
        }
        else
        {
            problems.AddRange(this.ValidateSection(projectItems, projectItem.Value.Item));
        }
    }
    problems.RemoveAll((Problem r) => r == null);
    return problems;
}

Here is the definition for SitecoreDeployInfo:

using HedgehogDevelopment.SitecoreCommon.Data.Items;
using System;

namespace HedgehogDevelopment.SitecoreProject.Tasks
{
    public class SitecoreDeployInfo
    {
        public IItem ParsedItem;

        public SitecoreItem Item;

        public SitecoreDeployInfo()
        {
        }
    }
}