c# - dotnet publish requires "Framework" version of MSBuild? - Stack Overflow

I have created a minimal project to test out ClickOnce:<Project Sdk="Microsoft.NET.Sdk"&g

I have created a minimal project to test out ClickOnce:

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

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <LangVersion>latest</LangVersion>
    <UseWPF>true</UseWPF>
  </PropertyGroup>
</Project>

My ClickOnceProfile.pubxml was generated using the GUI wizard in Visual Studio 2022.

If I publish using the GUI (i.e., right-click on the project and then "Publish") everything works as expected.

However, doing so from the CLI

dotnet publish -p:PublishProfile=ClickOnceProfile

results in the following error:

Error MSB4803: The task "GenerateBootstrapper" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See for further details.

I've tried adding <UseMSBuildRuntime>Framework</UseMSBuildRuntime> in my *csproj file, but the error persists.

Any help?

I have created a minimal project to test out ClickOnce:

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

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <LangVersion>latest</LangVersion>
    <UseWPF>true</UseWPF>
  </PropertyGroup>
</Project>

My ClickOnceProfile.pubxml was generated using the GUI wizard in Visual Studio 2022.

If I publish using the GUI (i.e., right-click on the project and then "Publish") everything works as expected.

However, doing so from the CLI

dotnet publish -p:PublishProfile=ClickOnceProfile

results in the following error:

Error MSB4803: The task "GenerateBootstrapper" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See https://aka.ms/msbuild/MSB4803 for further details.

I've tried adding <UseMSBuildRuntime>Framework</UseMSBuildRuntime> in my *csproj file, but the error persists.

Any help?

Share Improve this question edited Mar 7 at 9:50 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Mar 7 at 9:38 dowdow 5892 gold badges6 silver badges17 bronze badges 1
  • The following may be of interest: .NET application publishing overview. – It all makes cents Commented Mar 7 at 16:04
Add a comment  | 

1 Answer 1

Reset to default 0

I was experiencing the same issue, same error message.

I then located this comment https://github/dotnet/sdk/issues/33718#issuecomment-1615229332 which states "ClickOnce publish is not supported with dotnet publish. You will need to use msbuild".

I had tried many variations of the MSBuild, and I was also trying to get this working in an Azure DevOps pipeline.

What I eventually got working on local CMD prompt is:

MSBuild myproject.csproj /target:publish /p:PublishProfile=ClickOnceProfile

This resulted in the PublishDir folder specified in my ClickOnceProfile.pubxml containing the expected files, which is the setup.exe file, Application Manifest, Launcher.exe and an Application Files folder.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744938288a4602160.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信