gpt4 book ai didi

c# - 服务 MyServicePkg 缺少代码

转载 作者:太空狗 更新时间:2023-10-30 00:48:14 25 4
gpt4 key购买 nike

我正在尝试像这样升级我的应用程序:

enter image description here

失败并出现以下错误:

enter image description here

错误详情:

2>Test-ServiceFabricApplicationPackage : The BuildLayout of the application in
2>C:\Users\me\AppData\Local\Temp\TestApplicationPackage_2205895293421\4myc2vpp.bdq\Debug is invalid. Code is
2>missing for service MyServicePkg.
2>At C:\Program Files\Microsoft SDKs\Service
2>Fabric\Tools\PSModule\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1:135 char:38
2>+ ... nSuccess = (Test-ServiceFabricApplicationPackage $AppPkgPathToUse -Im ...
2>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2> + CategoryInfo : InvalidOperation: (:) [Test-ServiceFabricApplicationPackage], FabricImageBuilderValidati
2> onException
2> + FullyQualifiedErrorId : TestApplicationPackageErrorId,Microsoft.ServiceFabric.Powershell.TestApplicationPackage2>
2>Finished executing script 'Deploy-FabricApplication.ps1'.
2>Time elapsed: 00:00:40.4035177
2>The PowerShell script failed to execute.
========== Build: 1 succeeded, 0 failed, 46 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

这是我为该特定项目设置的属性:

enter image description here

我做错了什么?这个异常是什么意思?

最佳答案

我同意 Hans Passant 的评论:

The most basic mishap is that the name you used in the ServiceManifest.xml file does not match the name of the .exe that your project generates

它在您的调试输出中也可见,因为构建成功但发布失败。

========== Build: 1 succeeded, 0 failed, 46 up-to-date, 0 skipped ========== ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

它可能以多种方式发生,很可能是由于重命名项目或重命名程序集名称。如果您重命名项目或项目的 Assembly Name,您的构建可执行文件将根据该名称。考虑以下情况。

Application Properties

我将 Assembly Name 从“MyService”重命名为“MyRenamedService”。因此构建可执行文件将是 MyRenamedService.exe。因此,您必须在 ServiceManifest.xml 中进行设置。

<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>MyRenamedService.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>

确定构建可执行路径的最佳方法是构建解决方案。它将在输出窗口中显示可执行文件的完整路径。

1>------ Build started: Project: Web1, Configuration: Debug Any CPU ------
1>Web1 -> C:\.....\Application2\Web1\bin\Debug\net461\win7-x64\MyRenamedService.exe
2>------ Build started: Project: Application2, Configuration: Debug x64 ------
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

这里的Web1是我开始的Project Name,MyRenamedService.exe是build executable name(因为我重命名了Assembly Name),应该在ServiceManifest.xml 如上所示。

关于c# - 服务 MyServicePkg 缺少代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48772069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com