title: Dotnet build is returning different results
body: <p>I have a weird issue when I'm trying to build my *.csproj after generating new unity scripts.
  Let me explain the workflow.</p>
  <p>First I'm removing all old *.csproj files from the main Unity directory.
  Then I'm using following script, to generate all-new project files</p>
  <pre><code>var assemblies = AppDomain.CurrentDomain.GetAssemblies();
  foreach (var assembly in assemblies)
  {
      foreach (var type in assembly.GetTypes())
      {
          if (type.FullName == &quot;Packages.Rider.Editor.ProjectGeneration.ProjectGeneration&quot;)
          {
              var projectGeneration = Activator.CreateInstance(type);
              type.GetMethod(&quot;Sync&quot;).Invoke(projectGeneration,null);
              EditorApplication.Exit(0);
          }
      }
  }
  </code></pre>
  <p>Next I'm trying to build every *.csproj by cmd command: <code>dotnet build C:\Projects\xxx\xxx\*.csproj --force --no-restore</code></p>
  <p>This is where weird things are happening. The first run of the command is always returning many errors and warnings, but the actual number of them is different every time. The second time is reducing the number of them, and the third run usually results in no errors and just a few warnings.</p>
  <p>I know, that I'm not getting relevant results, because warnings that should appear, are not pointed after few runs.</p>
  <p>Here are some errors that are appearing</p>
  <pre><code>        CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\ARFoundation.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
          CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\xxx_OclussionCulling.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
          CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\QuickGraph.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
          CSC : error CS0006: Metadata file 'C:\Projects\xxx\xxx\Temp\Bin\Debug\Unity.XR.Interaction.Toolkit.dll' could not be found [C:\Projects\xxx\xxx\xxx.csproj]
  </code></pre>
  <p>My question is why this happens and how can I fix it? The main goal is to automate builds, but I have to build every *.csproj separately because I need to exclude some *.csproj's from the build.</p>