dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.41k stars 984 forks source link

ClickOnce seems broken for .NET 6.0 #5374

Closed TonyValenti closed 3 years ago

TonyValenti commented 3 years ago

Description

When trying to publish using ClickOnce and .NET6.0, publish fails and provides no useful information as to why.

Configuration

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ApplicationRevision>0</ApplicationRevision>
    <ApplicationVersion>1.0.0.*</ApplicationVersion>
    <BootstrapperEnabled>True</BootstrapperEnabled>
    <Configuration>Release</Configuration>
    <CreateDesktopShortcut>True</CreateDesktopShortcut>
    <CreateWebPageOnPublish>True</CreateWebPageOnPublish>
    <GenerateManifests>True</GenerateManifests>
    <Install>False</Install>
    <InstallFrom>Web</InstallFrom>
    <InstallUrl>https://Get.FasterLaw.com/UniversalMigrator/</InstallUrl>
    <IsRevisionIncremented>True</IsRevisionIncremented>
    <IsWebBootstrapper>True</IsWebBootstrapper>
    <MapFileExtensions>True</MapFileExtensions>
    <OpenBrowserOnPublish>False</OpenBrowserOnPublish>
    <Platform>Any CPU</Platform>
    <PublishDir>bin\publish\</PublishDir>
    <PublishUrl>bin\publish\</PublishUrl>
    <PublishProtocol>ClickOnce</PublishProtocol>
    <PublishReadyToRun>False</PublishReadyToRun>
    <PublishSingleFile>False</PublishSingleFile>
    <SelfContained>False</SelfContained>
    <SignatureAlgorithm>(none)</SignatureAlgorithm>
    <SignManifests>False</SignManifests>
    <TargetFramework>net6.0-windows</TargetFramework>
    <UpdateEnabled>False</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateRequired>False</UpdateRequired>
    <WebPageFileName>Publish.html</WebPageFileName>
  </PropertyGroup>
</Project>

Regression?

Yes. This used to work on .Net 5.0.

Other information

This information is given in the log:

7/29/2021 1:33:08 PM
System.AggregateException: One or more errors occurred. ---> 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 ---
---> (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. <---

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. 

===================

And the last few lines of the output log show:

121>------ Build started: Project: UniversalMigrator.Windows, Configuration: Release Any CPU ------
121>UniversalMigrator.Windows -> C:\Users\Tony Valenti\source\repos\MediatedCommunications\__BUILD\__CURRENT\net6.0-windows\UniversalMigrator.Windows.dll
122>------ Publish started: Project: UniversalMigrator.Windows, Configuration: Release Any CPU ------
122>The target "GetTargetPath" does not exist in the project.
122>The target "GetTargetPath" does not exist in the project.
========== Build: 121 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

I would wager that the GetTargetPath errors have something to do with the issue.

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

teo-tsirpanis commented 3 years ago

Are you not using an SDK-style project? Try replacing your project file's fifth line with

<Project Sdk="Microsoft.NET.Sdk">

And you can remove the lines above it, they are not needed.

TonyValenti commented 3 years ago

@teo-tsirpanis - I'm definitely using an SDK-style project. The above XML is actually the click-once publishing profile: image

The project file is as follows:

<Project Sdk="Microsoft.NET.Sdk">
  <Import Project="..\__Shared\Windows-Shared.targets" Label="Shared" />

  <PropertyGroup>
    <UseWindowsForms>true</UseWindowsForms>
    <ApplicationIcon />
    <OutputType>WinExe</OutputType>
    <StartupObject />
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DefineConstants>DEBUG;TRACE</DefineConstants>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Mono.Options" Version="6.6.0.161" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\Framework\Framework.Ipc.CommandLine\Framework.Ipc.CommandLine.csproj" />
    <ProjectReference Include="..\..\Framework\Framework.Ipc\Framework.Ipc.csproj" />
    <ProjectReference Include="..\..\Framework\Framework.Windows.Wpf.Notifications\Framework.Windows.Wpf.Notifications.csproj" />
    <ProjectReference Include="..\..\Framework\Framework.Windows.Wpf.Styles\Framework.Windows.Wpf.Styles.csproj" />
    <ProjectReference Include="..\..\Framework\Framework.Windows.Wpf\Framework.Windows.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.FolderAi.Wpf\UniversalMigrator.Extract.FolderAi.Wpf.csproj" />

    <!--Transform-->
    <ProjectReference Include="..\UniversalMigrator.Transform.Common.Wpf\UniversalMigrator.Transform.Common.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Validate.Common.Wpf\UniversalMigrator.Validate.Common.Wpf.csproj" />

    <!--Inject-->

    <ProjectReference Include="..\UniversalMigrator.Inject.ActionStep.Wpf\UniversalMigrator.Inject.ActionStep.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.Clio.Wpf\UniversalMigrator.Inject.Clio.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.Folder.Wpf\UniversalMigrator.Inject.Folder.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.NdImport.Wpf\UniversalMigrator.Inject.NdImport.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.NetDocuments.Wpf\UniversalMigrator.Inject.NetDocuments.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.Neos.Wpf\UniversalMigrator.Inject.Neos.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.RocketMatter.Wpf\UniversalMigrator.Inject.RocketMatter.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Inject.Smokeball.Wpf\UniversalMigrator.Inject.Smokeball.Wpf.csproj" />

    <!--Extract-->

    <ProjectReference Include="..\UniversalMigrator.Extract.Abacus.Wpf\UniversalMigrator.Extract.Abacus.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.AbacusAccounting.Wpf\UniversalMigrator.Extract.AbacusAccounting.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Amicus.Wpf\UniversalMigrator.Extract.Amicus.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.ClientProfiles.Wpf\UniversalMigrator.Extract.ClientProfiles.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Clio.Wpf\UniversalMigrator.Extract.Clio.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.DocumentLocator.Wpf\UniversalMigrator.Extract.DocumentLocator.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.FirmCentral.Wpf\UniversalMigrator.Extract.FirmCentral.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Folder.Wpf\UniversalMigrator.Extract.Folder.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.IManage.Wpf\UniversalMigrator.Extract.IManage.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Juris.Wpf\UniversalMigrator.Extract.Juris.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.LaserFiche.Wpf\UniversalMigrator.Extract.LaserFiche.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.LawBase.Wpf\UniversalMigrator.Extract.LawBase.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.LawCloud.Wpf\UniversalMigrator.Extract.LawCloud.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Needles.Wpf\UniversalMigrator.Extract.Needles.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.PcLaw.Wpf\UniversalMigrator.Extract.PcLaw.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Pika.Wpf\UniversalMigrator.Extract.Pika.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.PracticePanther.Wpf\UniversalMigrator.Extract.PracticePanther.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Prevail.Wpf\UniversalMigrator.Extract.Prevail.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.ProLaw.Wpf\UniversalMigrator.Extract.ProLaw.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Tabs.Wpf\UniversalMigrator.Extract.Tabs.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.TimeMatters.Wpf\UniversalMigrator.Extract.TimeMatters.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.TimeSlips.Wpf\UniversalMigrator.Extract.TimeSlips.Wpf.csproj" />

    <!--Not Implemeneted-->
    <ProjectReference Include="..\UniversalMigrator.Extract.Aderant.Wpf\UniversalMigrator.Extract.Aderant.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.CosmoLex.Wpf\UniversalMigrator.Extract.CosmoLex.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Intact.Wpf\UniversalMigrator.Extract.Intact.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Jarvis.Wpf\UniversalMigrator.Extract.Jarvis.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Leap.Wpf\UniversalMigrator.Extract.Leap.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.MyCase.Wpf\UniversalMigrator.Extract.MyCase.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.PerfectLaw.Wpf\UniversalMigrator.Extract.PerfectLaw.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.Worldox.Wpf\UniversalMigrator.Extract.Worldox.Wpf.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Extract.ZolaSuite.Wpf\UniversalMigrator.Extract.ZolaSuite.Wpf.csproj" />

    <!--TODO-->
    <!--
    <ProjectReference Include="..\UniversalMigrator.Migrations.Csv.Documents.Extract\UniversalMigrator.Migrations.Csv.Documents.Extract.csproj" />
    <ProjectReference Include="..\UniversalMigrator.Migrations.Csv.Inject\UniversalMigrator.Migrations.Csv.Inject.csproj" />
    -->
    <ProjectReference Include="..\UniversalMigrator.Wpf\UniversalMigrator.Wpf.csproj" />

  </ItemGroup>

  <ItemGroup>
    <Reference Include="Telerik.Windows.Themes.Office2016">
      <HintPath>..\..\Framework\__PACKAGES\Telerik.Windows.Controls\WPF50\Telerik.Windows.Themes.Office2016.dll</HintPath>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <Resource Include="Resources\icon(all).psd" />
    <Resource Include="Resources\icon.all.ico" />
    <Resource Include="Resources\icon.small.ico" />
    <Resource Include="Resources\Logo_White.png" />
  </ItemGroup>

  <ItemGroup>
    <Compile Update="Resources\Resources.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Update="Resources\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

</Project>

What do you suggest?

teo-tsirpanis commented 3 years ago

Oh, I did not know that about the publishing profiles, I am not familiar with ClickOnce, the legacy project header was the first thing I noticed upon seeing the issue.

But I would still change the publishing profile as I initially suggested and try again if I I were you. The error messages indicate that MSBuild cannot find a target, and seem consistent with a missing SDK import.

If it still doesn't work the problem is deeper and we should better wait for a .NET team member.

dreddy-work commented 3 years ago

@John-Hart / @NikolaMilosavljevic to help on this.

TonyValenti commented 3 years ago

I’ve Zipped up the entire project. Email me at @.*** and I’ll send you a copy of the zip so you can see it first hand.

RussKie commented 3 years ago

@TonyValenti please raise a VS Feedback (top right in the Visual Studio), attach your project to the ticket, and post the link to that issue here. Thanks

TonyValenti commented 3 years ago

@RussKie - Thanks! I have just submitted it via VS Feedback: https://developercommunity.visualstudio.com/t/ClickOnce-Fails-to-Publish/1492807?space=8&q=ClickOnce

TonyValenti commented 3 years ago

@RussKie - I also attached a ZIP file containing a complete project that demonstrates the issue. Open the Universal Migrator.sln and then try to publish UniversalMigrator.Windows. You'll see the clickonce errors.

dreddy-work commented 3 years ago

This issue is being tracked via Feedback ticket. Alternatively, ClickOnce publishing on core issues can be raised at https://github.com/dotnet/deployment-tools

sujitnayak commented 3 years ago

This issue has been RC'ed to a multi-targeting class library in the solution that ClickOnce does not handle correctly. A fix for this is in the works for 16.11. Thanks.