title: .NET 5 TargetFramework issue with referenced project when publishing WPF App over ClickOnce
body: <p>I'm trying to publish a WPF app with Target Framework net5.0-windows using ClickOnce (Built in VS2019), which has a Project Reference to another .NET5 Class Library.</p>
  <p>But I always run into the following exception:</p>
  <blockquote>
  <p>Publish has encountered an error.</p>
  <p>Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.</p>
  </blockquote>
  <p>The diagnostic log shows me the exact exception:</p>
  <blockquote>
  <p>System.AggregateException: One or more errors occurred. ---&gt; Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
  --- End of inner exception stack trace ---</p>
  <p>---&gt; (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. &lt;---</p>
  <p>Microsoft.WebTools.Shared.Exceptions.WebToolsException: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.</p>
  </blockquote>
  <p>The issue can be easily reproduced:</p>
  <ol>
  <li>Create new Solution with a WPF project (.NET5)</li>
  <li>Create new Class Library (.NET5) in this solution</li>
  <li>Reference the ClassLibrary from the WPF App</li>
  <li>Try to publish the WPF App with ClickOnce (right-click the WPF App project -&gt; Publish -&gt; ClickOnce, ...)</li>
  </ol>
  <p>Here's a Demo project, which I've created followed the steps above:</p>
  <p><strong>PublishDemo.Core (Class library)</strong></p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
     &lt;PropertyGroup&gt;
        &lt;TargetFramework&gt;net5.0&lt;/TargetFramework&gt;
     &lt;/PropertyGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p><strong>PublishDemo.Wpf (WPF App)</strong></p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
      &lt;PropertyGroup&gt;
          &lt;OutputType&gt;WinExe&lt;/OutputType&gt;
          &lt;TargetFramework&gt;net5.0-windows&lt;/TargetFramework&gt;
          &lt;UseWPF&gt;true&lt;/UseWPF&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;ItemGroup&gt;
          &lt;ProjectReference Include=&quot;..\PublishDemo.Core\PublishDemo.Core.csproj&quot; /&gt;
      &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>The Build output displays the following error:</p>
  <blockquote>
  <p>Metadata file 'C:\work\source\unmanaged\PublishDemo\PublishDemo\PublishDemo.Core\bin\Release\net5.0-windows\PublishDemo.Core.dll' could not be found</p>
  </blockquote>
  <p>When using the Release-build configuration it tries to referece to the path <strong>\bin\Release\net5.0-windows</strong> which I think does not make any sense because the Class library targets the framework type <strong>net5.0</strong>. Also after checking the folders the Class library indeed puts the built files into a folder called <strong>net5.0</strong>.</p>
  <p>Problem is I don't know where I can change that or if there is a workaround for that issue.
  I have already updated to the newest VisualStudio version (16.9.0), since I thought maybe it's because ClickOnce way newly implemented in Vs, but this did not solve the issue.
  Publishing to a Folder works. Azure I don't have, so I cannot try that.</p>
  <p>Can anybody help me with this issue?
  Also if you need more information, I'm happy to provide it.</p>