title: TypeScript not building with Azure Hosted Agent
body: <p>I have an ASP.NET MVC application written in .Net5.</p>
  <p>This uses typescript files and I have NuGet package references to the following:</p>
  <pre><code>&lt;PackageReference Include=&quot;BuildBundlerMinifier&quot; Version=&quot;3.2.449&quot; /&gt;
  &lt;PackageReference Include=&quot;Microsoft.TypeScript.MSBuild&quot; Version=&quot;4.0.3&quot;&gt;
    &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
    &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
  &lt;/PackageReference&gt;
  &lt;PackageReference Include=&quot;Microsoft.Web.LibraryManager.Build&quot; Version=&quot;2.1.113&quot; /&gt;
  </code></pre>
  <p>In my project I have:</p>
  <ul>
  <li>Folder called <code>node-modules</code> (not pushed to Azure Devops)</li>
  <li>bundleconfig.json</li>
  <li>gulpfile.js</li>
  <li>libman.json</li>
  <li>package.json (+ package-lock.json)</li>
  </ul>
  <p>The <code>package.json</code> is:</p>
  <pre><code>{
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;name&quot;: &quot;asp.net&quot;,
    &quot;private&quot;: true,
    &quot;devDependencies&quot;: {
      &quot;gulp&quot;: &quot;4.0.2&quot;,
      &quot;del&quot;: &quot;5.1.0&quot;,
      &quot;@types/bootstrap&quot;: &quot;4.5.0&quot;,
      &quot;@types/google.visualization&quot;: &quot;0.0.53&quot;,
      &quot;@types/jquery&quot;: &quot;3.5.1&quot;,
      &quot;@types/jqueryui&quot;: &quot;1.12.13&quot;,
      &quot;@types/jquery.datatables&quot;: &quot;1.10.36&quot;,
      &quot;@types/jquery.ui.datetimepicker&quot;: &quot;0.3.29&quot;
    }
  }
  </code></pre>
  <p>When I compile in Visual Studio 2019 (latest) it compiles perfectly, everything works as expected.</p>
  <p>I did however get in the Build Output (Information):</p>
  <blockquote>
  <p>Package restore on project open is disabled. Change the npm package
  management settings in Project Properties to enable restore on project
  open.</p>
  </blockquote>
  <p>I found the setting &quot;Restore On Project Save&quot; and changed this to <code>true</code>.  That added the following to my csproj file:</p>
  <pre><code>&lt;ProjectExtensions&gt;&lt;VisualStudio&gt;&lt;UserProperties appsettings_1qaf_1json__JsonSchema=&quot;https://gitpod.io/schemas/gitpod-schema.json&quot; NpmRestoreOnProjectOpen=&quot;True&quot; /&gt;&lt;/VisualStudio&gt;&lt;/ProjectExtensions&gt;
  </code></pre>
  <p>I pushed this up to Azure DevOps, but when the agent builds it (some steps removed for clarity):</p>
  <pre><code>variables:
    solution: '**/*.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'
  
  steps:
  
  - task: NuGetToolInstaller@1
  
  - task: NuGetCommand@2
    inputs:
      command: 'restore'
      restoreSolution: '**/*.sln'
      feedsToUse: 'select'
  
  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      configuration: '$(buildConfiguration)'
      clean: true
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>##[error]MyApp\Scripts\MyTypeScript.ts(13,9): Error TS2581: Build:Cannot find name '$'. Do you need to install type
  definitions for jQuery? Try <code>npm i @types/jquery</code>.</p>
  </blockquote>
  <p>So, the hosted agent is evidently not retrieving the types.  I'm guessing I need to adjust my YAML file, but unsure how...</p>