简体   繁体   English

在 Visual Studio 2022 中,发布到 IIS 返回构建错误,但是发布到文件夹是可以的(之前一切正常)

[英]In Visual Studio 2022, publish to IIS returns a build error, but publish to Folder is ok (and it was all working fine before)

I've updated Visual Studio 2022 to 17.1.0 recently and I now have this weird error, but not on every project (on only one up to now).我最近将 Visual Studio 2022 更新到 17.1.0,现在我遇到了这个奇怪的错误,但不是在每个项目上(到目前为止只有一个)。 I've tested other projects and they still work fine.我已经测试了其他项目,它们仍然可以正常工作。

But this one project won't publish to IIS. It builds/runs locally, it can publish to a Folder profile, and a previous version is working in IIS.但是这个项目不会发布到 IIS。它在本地构建/运行,它可以发布到文件夹配置文件,并且以前的版本在 IIS 中运行。

It's a .NET 6.0 web api project.这是一个 .NET 6.0 web api 项目。

In the Output window I can see these 2 errors:在 Output window 我可以看到这两个错误:

Error CTC1000: Method not found: 'Void Microsoft.VisualStudio.Containers.Tools.Shared.Functions.AzureFunctionsFeedDataProvider..ctor(Microsoft.VisualStudio.Containers.Tools.Common.Services.Logging.ILoggingService)'.
Error MSB4018: The "KillAppInsideContainer" task failed unexpectedly.

But I'm not deploying on Azure and I'm not deploying on a container.但我没有在 Azure 上部署,也没有在容器上部署。 The project was set up for Docker use but I commented out the <DockerDefaultTargetOS> part of the.csproj and excluded the dockerfile from the project to test if it impacted the resut;该项目设置为 Docker 使用,但我注释掉了 the.csproj 的<DockerDefaultTargetOS>部分,并从项目中排除了dockerfile以测试它是否影响了结果; it removes the KillAppInsideContainer error but not the other one.它删除了KillAppInsideContainer错误,但没有删除另一个错误。

Any help appreciated!任何帮助表示赞赏! Thanks谢谢

To solve this publishing issue, I came back from Microsoft.VisualStudio.Azure.Containers.Tools.Targets version 1.14.0 to version 1.11.1 from nuget packages为了解决这个发布问题,我从Microsoft.VisualStudio.Azure.Containers.Tools.Targets版本1.14.0回到版本1.11.1从 nuget 包

I suddenly had the same problem today and could get rid of it by upgrading Microsoft.VisualStudio.Azure.Containers.Tools.Targets from 1.14.0 to 1.15.1 .我今天突然遇到了同样的问题,可以通过将 Microsoft.VisualStudio.Azure.Containers.Tools.Targets 从1.14.0升级到1.15.1来摆脱它。

Remove package Microsoft.VisualStudio.Containers.* || Microsoft.VisualStudio.azure.Containers.*

For what it's worth, this is what I had to do on my PC:对于它的价值,这是我必须在我的电脑上做的:

  • In Visual Studio's "Tools" / "Options" menu, get to "Project and Solutions" / "Azure Funtions"在 Visual Studio 的“工具”/“选项”菜单中,转到“项目和解决方案”/“Azure Funtions”
  • Click on "Check for updates" and do updates if any单击“检查更新”并进行更新(如果有)
  • Click on "Check for unused toolsets" and remove any unused toolset if any.单击“检查未使用的工具集”并删除任何未使用的工具集(如果有)。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM