title: Why am I receiving an error when running my pipeline?
body: <p>I have a fairly large project that I use Azure Pipelines to automate my deployments. I use a local build agent due to some licensing in one of our libraries.</p>
  
  <p>However suddenly the project is failing when it gets to the publish step. I have tried to rebuild several times. I have dug through the logs and they don't really make sense. </p>
  
  <pre><code>2020-02-20T14:18:19.3341737Z ##[error]Path\To\File\Edit.cshtml(201,0): Error CS1525: Invalid expression term '.'
  </code></pre>
  
  <p>The problem is that when I publish locally there are no errors. The part of the file it is referencing is a nullable datetime. It throws a handful of these errors all referencing nullable datetime objects. The only thing I can think that has changed recently is I installed VS2019. However my pipeline is still set to us VS2017. The logs also shows it is using msbuild 15.0.</p>
  
  <p>I'm at a bit of a loss here. Anyone know what I might have missed? Or maybe some troubleshooting steps I'm not seeing? I have my full failed build log as well if any additional info is needed.</p>
  
  <p>Contents of Edit.cshtml</p>
  
  <pre><code>@model Project.Portal.Domain.Models.CompanyContact.EditViewModel
  
  @{
      ViewBag.Title = "Edit Company Contact";
      Layout = "~/Views/Shared/_Popup.cshtml";
  }
  
  @using (Html.BeginForm("Edit", "CompanyContact"))
  {
      &lt;div&gt;
          @Html.ValidationSummary()
      &lt;/div&gt;
  
      &lt;div id="companyContactDetail"&gt;
          @Html.HiddenFor(x =&gt; x.Id)
          @Html.HiddenFor(x =&gt; x.CompanyId)
          @Html.HiddenFor(x =&gt; x.ContactId)
          @Html.HiddenFor(x =&gt; x.CreatedBy)
          @Html.HiddenFor(x =&gt; x.CreatedOn)
          @Html.HiddenFor(x =&gt; x.ModifiedBy)
          @Html.HiddenFor(x =&gt; x.ModifiedOn)
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.IsPrimary)
                  &lt;br /&gt;
                  @Html.Kendo().CheckBoxFor(x =&gt; x.IsPrimary).Label(string.Empty)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.IsSecondary)
                  &lt;br /&gt;
                  @Html.Kendo().CheckBoxFor(x =&gt; x.IsSecondary).Label(string.Empty)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.IsOwner)
                  &lt;br /&gt;
                  @Html.Kendo().CheckBoxFor(x =&gt; x.IsOwner).Label(string.Empty)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.OwnershipPercentage)
                  &lt;br /&gt;
                  @Html.Kendo().NumericTextBoxFor(x =&gt; x.OwnershipPercentage).Enable(Model.IsOwner)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.IsGuarantor)
                  &lt;br /&gt;
                  @Html.Kendo().CheckBoxFor(x =&gt; x.IsGuarantor).Label(string.Empty)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-12 text-center"&gt;
                  &lt;a href="#" onclick="window.parent.$('#CompanyContact-Window').data('kendoWindow').close();" class="btn btn-warning"&gt;Cancel&lt;/a&gt;
                  &lt;a href="#" onclick="showContactDetail();" class="btn btn-primary"&gt;Next&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="contactDetail" style="display: none;"&gt;
          @Html.HiddenFor(x =&gt; x.Contact.Id)
          @Html.HiddenFor(x =&gt; x.Contact.SocialSecurityNumber)
          @Html.HiddenFor(x =&gt; x.Contact.EditSocialSecurityNumber)
          @Html.HiddenFor(x =&gt; x.Contact.CreatedBy)
          @Html.HiddenFor(x =&gt; x.Contact.CreatedOn)
          @Html.HiddenFor(x =&gt; x.Contact.ModifiedBy)
          @Html.HiddenFor(x =&gt; x.Contact.ModifiedOn)
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.FirstName)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.FirstName)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.LastName)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.LastName)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.Title)
                  &lt;br/&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.Title)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.FicoScore)
                  &lt;br/&gt;
                  @Html.Kendo().NumericTextBoxFor(x =&gt; x.Contact.FicoScore).Decimals(0).Format("n0")
                  @Html.ValidationMessageFor(x =&gt; x.Contact.FicoScore)
              &lt;/div&gt;
          &lt;/div&gt;
          @if (Project.Portal.Common.Security.CurrentUser.CanEditSocialSecurityNumber())
          {
              &lt;div class="row" style="padding-top: 10px;"&gt;
                  &lt;div class="col-xs-12"&gt;
                      @Html.LabelFor(x =&gt; x.Contact.SocialSecurityNumber)
                      &lt;br /&gt;
                      &lt;a href="#" id="editSSN" onclick="editSSN();" style="display: @(Model.Contact.EditSocialSecurityNumber ? "none" : "block");"&gt;Edit Social Security Number&lt;/a&gt;
                      &lt;a href="#" id="cancelSSN" onclick="cancelSSNEdit();" style="display: @(Model.Contact.EditSocialSecurityNumber ? "block" : "none");"&gt;Cancel Social Security Number Edit&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div id="ssnEdit" style="display: @(Model.Contact.EditSocialSecurityNumber ? "block" : "none");"&gt;
                      &lt;div class="col-xs-6"&gt;
                          @Html.Kendo().MaskedTextBoxFor(x =&gt; x.Contact.NewSocialSecurityNumber).Mask("999-99-9999")
                      &lt;/div&gt;
                      &lt;div class="col-xs-6"&gt;
                          @Html.Kendo().MaskedTextBoxFor(x =&gt; x.Contact.ConfirmNewSocialSecurityNumber).Mask("999-99-9999")
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          }
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.Address1)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.Address1)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.Address2)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.Address2)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.City)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.City)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.State)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.State)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.ZipCode)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.ZipCode)
              &lt;/div&gt;
              &lt;div class="col-xs-6"&gt;
                  @Html.LabelFor(x =&gt; x.Contact.Country)
                  &lt;br /&gt;
                  @Html.Kendo().TextBoxFor(x =&gt; x.Contact.Country)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-12 text-center"&gt;
                  &lt;a href="#" onclick="showCompanyContactDetail();
  " class="btn btn-primary"&gt;Previous&lt;/a&gt;
                  &lt;a href="#" onclick="window.parent.$('#CompanyContact-Window').data('kendoWindow').close();" class="btn btn-warning"&gt;Cancel&lt;/a&gt;
                  &lt;a href="#" onclick="showContactEmailAndPhoneDetail();" class="btn btn-primary"&gt;Next&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="contactEmaiAndPhoneDetail" style="display: none;"&gt;
  
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;label&gt;Email(s)&lt;/label&gt;
              &lt;a class="pull-right" href="#" onclick="addNewEmail();"&gt;Add New&lt;/a&gt;
              &lt;hr /&gt;
              &lt;div id="contactEmails"&gt;
                  @if (Model.Contact.ContactEmails != null)
                  {
                      foreach (var model in Model.Contact.ContactEmails)
                      {
                          @Html.Partial("~/Views/ContactEmail/CompanyContactEdit.cshtml", model)
                      }
                  }
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;label&gt;Phone(s)&lt;/label&gt;
              &lt;a class="pull-right" href="#" onclick="addNewPhoneNumber();"&gt;Add New&lt;/a&gt;
              &lt;hr /&gt;
              &lt;div id="contactPhoneNumbers"&gt;
                  @if (Model.Contact.ContactPhoneNumbers != null)
                  {
                      foreach (var model in Model.Contact.ContactPhoneNumbers)
                      {
                          @Html.Partial("~/Views/ContactPhoneNumber/CompanyContactEdit.cshtml", model)
                      }
                  }
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="row" style="padding-top: 10px;"&gt;
              &lt;div class="col-xs-12 text-center"&gt;
                  &lt;a href="#" onclick="showContactDetail();" class="btn btn-primary"&gt;Previous&lt;/a&gt;
                  &lt;a href="#" onclick="window.parent.$('#CompanyContact-Window').data('kendoWindow').close();" class="btn btn-warning"&gt;Cancel&lt;/a&gt;
                  &lt;button type="submit" class="btn btn-success" onclick="kendo.ui.progress($('body'), true);"&gt;Save&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  }
  
  &lt;script type="text/javascript"&gt;
      var contactId = @Model.Contact.Id;
      var nextEmailIndex = @(Model.Contact.ContactEmails?.Count ?? 0);
      var nextPhoneNumberIndex = @(Model.Contact.ContactPhoneNumbers?.Count ?? 0);
  
      $(document).ready(function () {
          $("#@Html.IdFor(x =&gt; x.IsPrimary)").click(function () {
              if ($(this).prop("checked")) {
                  $("#@Html.IdFor(x =&gt; x.IsSecondary)").prop("checked", false);
              }
          });
  
          $("#@Html.IdFor(x =&gt; x.IsSecondary)").click(function () {
              if ($(this).prop("checked")) {
                  $("#@Html.IdFor(x =&gt; x.IsPrimary)").prop("checked", false);
              }
          });
  
          $("#@Html.IdFor(x =&gt; x.IsOwner)").click(function () {
              var ownershipPercentage = $("#@Html.IdFor(x =&gt; x.OwnershipPercentage)").data("kendoNumericTextBox");
  
              if ($(this).prop("checked")) {
                  ownershipPercentage.enable(true);
              } else {
                  ownershipPercentage.enable(false);
              }
          });
      });
  
      function showContactDetail() {
          $("#companyContactDetail").hide();
          $("#contactEmaiAndPhoneDetail").hide();
  
          $("#contactDetail").show();
  
          return false;
      }
  
      function showCompanyContactDetail() {
          $("#contactDetail").hide();
          $("#contactEmaiAndPhoneDetail").hide();
  
          $("#companyContactDetail").show();
  
          return false;
      }
  
      function showContactEmailAndPhoneDetail() {
          $("#companyContactDetail").hide();
          $("#contactDetail").hide();
  
          $("#contactEmaiAndPhoneDetail").show();
  
          return false;
      }
  
      function addNewEmail() {
          var div = $("#contactEmails");
  
          kendo.ui.progress($("#contactEmails"), true);
  
          $.ajax({
              url: "@Url.Action("CompanyContactAdd", "ContactEmail")?contactId=" + contactId,
              type: "POST",
          success: function(e) {
              div.append(e);
  
              kendo.ui.progress($("#contactEmails"), false);
          }
      });
  
      return false;
      }
  
      function addNewPhoneNumber() {
          var div = $("#contactPhoneNumbers");
  
          kendo.ui.progress($("#contactPhoneNumbers"), true);
  
          $.ajax({
              url: "@Url.Action("CompanyContactAdd", "ContactPhoneNumber")?contactId=" + contactId,
              type: "POST",
              success: function(e) {
                  div.append(e);
  
                  kendo.ui.progress($("#contactPhoneNumbers"), false);
              }
          });
  
          return false;
      }
  
      function editSSN() {
          $("#editSSN").hide();
          $("#cancelSSN").show();
          $("#ssnEdit").show();
  
          $("#@Html.IdFor(x =&gt; x.Contact.EditSocialSecurityNumber)").val("True");
      }
  
      function cancelSSNEdit() {
          $("#ssnEdit").hide();
          $("#cancelSSN").hide();
          $("#editSSN").show();
  
          $("#@Html.IdFor(x =&gt; x.Contact.EditSocialSecurityNumber)").val("False");
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Edit 2:</strong> Pipeline Details</p>
  
  <pre><code>pool:
    name: Default
    demands:
    - msbuild
    - visualstudio
  
  variables:
    BuildPlatform: 'any cpu'
    BuildConfiguration: 'debug'
  
  steps:
  - task: NuGetToolInstaller@0
    displayName: 'Use NuGet 4.4.1'
    inputs:
      versionSpec: 4.4.1
  
  - task: NuGetInstaller@0
    displayName: 'NuGet restore Project.sln'
    inputs:
      solution: '$(Parameters.solution)'
  
  - task: VSBuild@1
    displayName: 'Build solution Project.sln'
    inputs:
      solution: '$(Parameters.solution)'
      vsVersion: 15.0
      platform: '$(BuildPlatform)'
      configuration: '$(BuildConfiguration)'
  
  - task: PublishSymbols@1
    displayName: 'Publish symbols path'
    inputs:
      SearchPattern: '**\bin\**\*.pdb'
    continueOnError: true
  
  - task: VSBuild@1
    displayName: 'Publish Solution Project.sln'
    inputs:
      solution: Project.sln
      vsVersion: 15.0
      msbuildArgs: '/P:PublishProfile=Development /P:DeployOnBuild=true'
      platform: '$(BuildPlatform)'
      configuration: '$(BuildConfiguration)'
      clean: true
  
  - task: CopyFiles@1
    displayName: 'Copy Portal Files'
    inputs:
      SourceFolder: '$(build.sourcesdirectory)'
      Contents: 'Project.Portal.Presentation.Mvc\Publish\**'
      TargetFolder: '$(build.artifactstagingdirectory)\Website'
  
  - task: CopyFiles@1
    displayName: 'Copy API Files'
    inputs:
      SourceFolder: '$(build.sourcesdirectory)'
      Contents: 'Project.Portal.Presentation.Api\Publish\**'
      TargetFolder: '$(build.artifactstagingdirectory)\Api'
  
  - task: CopyFiles@1
    displayName: 'Copy Customer Files'
    inputs:
      SourceFolder: '$(build.sourcesdirectory)'
      Contents: 'Project.Portal.Presentation.Customer\Publish\**'
      TargetFolder: '$(build.artifactstagingdirectory)\Customer'
  
  - task: CopyFiles@1
    displayName: 'Copy DB Files'
    inputs:
      SourceFolder: '$(build.sourcesdirectory)'
      Contents: 'Project.Portal.Data.Database\bin\Debug\Project.Portal.Data.Database.dacpac'
      TargetFolder: '$(build.artifactstagingdirectory)\Database'
  
  - task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: drop'
    inputs:
      ArtifactName: '$(Parameters.ArtifactName)'
  </code></pre>
  
  <p><strong>Edit 3:</strong>
  So I reverted my code base to the last known working release and tried again. I then got the Same errors.</p>