Я получал указанную ниже ошибку всякий раз, когда пытался опубликовать эту службу Windows
Error 116 "obj\Debug\WindowsService.csproj.WindowsService.exe.config;obj\Debug\WindowsDateService.exe.config" is an invalid value for the "ConfigFile" parameter of the "GenerateApplicationManifest" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
Поэтому я закомментировал узел группы элементов, показанный ниже в файле .csproj.
<TransformXml Source = "App.config" Destination = "$(IntermediateOutputPath)$(TargetFileName).config" Transform = "App.$(Configuration).config" />
<!--Force build process to use the transformed configuration file from now on.-->
<ItemGroup>
<AppConfigWithTargetPath Remove = "App.config" />
<AppConfigWithTargetPath Include = "$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
Итак, я избавился от упомянутой выше ошибки и смог опубликовать службу Windows в папке .. Теперь, когда я пытаюсь запустить файл setup.exe, я получаю сообщение об ошибке. Подробности ошибки указаны ниже.
at System.Deployment.Application.ComponentVerifier.VerifyFileHash(String filePath, Hash hash) at System.Deployment.Application.ComponentVerifier.VerifyFileHash(String filePath, HashCollection hashCollection) at System.Deployment.Application.ComponentVerifier.VerifyComponents() at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options) at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp) at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl, Uri& deploymentUri) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activation





Вы используете Visual Studio 2017 версии 15.5 или выше?
Попробуйте изменить:
<AppConfigWithTargetPath Remove = "app.config" />
К:
<AppConfigWithTargetPath Remove = "@(AppConfigWithTargetPath)"/>
У меня была такая же ошибка, и мне помог этот пост: https://developercommunity.visualstudio.com/solutions/183829/view.html