作者:Arthur小熊 | 来源:互联网 | 2023-08-12 08:07
我试图像这样升级我的应用程序:它失败并出现以下错误:错误详情:2Test-ServiceFabricApplicationPackage:TheBuildLayoutofthea
我试图像这样升级我的应用程序:
![enter image description here](https://img.php1.cn/3cd4a/1eebe/cd5/d34245582687a4e6.webp)
它失败并出现以下错误:
![enter image description here](https://img.php1.cn/3cd4a/1eebe/cd5/d84f9786330d9e41.png)
错误详情:
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.TestApplicationPackage
2>
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](https://img.php1.cn/3cd4a/1eebe/cd5/7494af3c1cda418d.webp)
我究竟做错了什么?这个例外是什么意思?
解决方法:
我会选择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 ==========
它可能以多种方式发生,并且很可能是由于重命名项目或重命名程序集名称.如果重命名项目或项目的程序集名称,则构建可执行文件将根据该名称.考虑以下情况.
![Application Properties](https://img.php1.cn/3cd4a/1eebe/cd5/7cccb7e4b6cb5cb8.webp)
我将程序集名称从“MyService”重命名为“MyRenamedService”.因此构建可执行文件将是MyRenamedService.exe.所以你必须在ServiceManifest.xml中设置它.
MyRenamedService.exe
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是构建可执行文件名(因为我重命名了Assembly Name),它应该在ServiceManifest.xml中设置,如上所示.