title: How to resolve MSBuild throws Error MSB3030: Could not copy the file "Scripts\dist\main.bundle.js" because it was not found
body: <p>Azure Pipeline project has two Build Agents</p>
  
  <ol>
  <li>Build Angular Project.</li>
  </ol>
  
  <p>Builds successfully and assets, chunk.js files and bundle.js files published as Artifacts</p>
  
  <ol start="2">
  <li>Build ASP.net Web Application.</li>
  </ol>
  
  <p>I download the Artifacts from previous build agents and extract them inside the <strong>$(build.stagingDirectory)/Scripts/dist</strong> directory since they will be consumed by the ASP.net project.</p>
  
  <p>My <strong>Extract files</strong> task ymal is </p>
  
  <pre><code>steps:
  - task: ExtractFiles@1
    displayName: 'Extract files bundle.zip'
    inputs:
      archiveFilePatterns: '$(Pipeline.Workspace)/dist/$(Build.BuildId)_bundle.zip'
      destinationFolder: '$(build.sourcesDirectory)/Scripts/dist' 
  </code></pre>
  
  <p>When the <strong>MSBuild</strong> build the ASP.net project it is not able to find the <code>##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets(182,5): Error MSB3030: Could not copy the file "Scripts\dist\main.bundle.js" because it was not found.</code></p>
  
  <p>MS Build yaml is :</p>
  
  <pre><code>steps:
  - task: MSBuild@1
    displayName: 'Build solution NMG.Portal.MVCForAngular'
    inputs:
      solution: NMG.WebApp.MVCForAngular/NMG.WebApp.MVCForAngular.csproj
      msbuildArguments: '/p:ProjectFile=$(build.sourcesDirectory)\NMG.WebApp.MVCForAngular\NMG.WebApp.MVCForAngular.csproj /p:DeployOnBuild=true /p:SkipInvalidConfigurations=true /p:OutDir="$(build.stagingDirectory)\\"'
      clean: false
      logProjectEvents: true
      createLogFile: true
  </code></pre>
  
  <p>My ASP.NET BundleConfig.cs file has bellow code.</p>
  
  <pre><code>public class BundleConfig
      {
          // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
          public static void RegisterBundles(BundleCollection bundles)
          {
              bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                          "~/Scripts/jquery-{version}.js"));
              // Use the development version of Modernizr to develop with and learn from. Then, when you're
              // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
              bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                          "~/Scripts/modernizr-*"));
  
              bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                        "~/Scripts/bootstrap.js",
                        "~/Scripts/respond.js"));
  
              bundles.Add(new StyleBundle("~/Content/css").Include(
                        "~/Content/bootstrap.css",
                        "~/Content/site.css"));
  
              bundles.Add(new ScriptBundle("~/bundles/nmg").Include(
                  "~/Scripts/dist/inline*",
                  "~/Scripts/dist/polyfills*",
                  "~/Scripts/dist/scripts*",
                  "~/Scripts/dist/vendor*",
                  "~/Scripts/dist/main*"));
  
              bundles.Add(new StyleBundle("~/Content/nmg").Include(
                   "~/Scripts/dist/styles*"));
          }
      }
  </code></pre>
  
  <p>Logically this should work. </p>
  
  <p>I would like to know what is missing here? Why the MSBuild could not find the bundles that i extracted inside the Scripts/dist.</p>
  
  <p>The main.bundle.js that is copied to Scripts/dist folder is main.7515c53aa0f2ef625908.bundle.js but MSBuild does not consider it. </p>