Windows服务安装错误

时间:2018-04-09 15:33:53

标签: c# .net service publishing

每当我尝试发布此Windows服务时,我都会收到以下提到的错误

  

错误116" obj \ Debug \ WindowsService.csproj.WindowsService.exe.config; obj \ Debug \ WindowsDateService.exe.config"   是" ConfigFile"的无效值。的参数   " GenerateApplicationManifest"任务。无法传递多个项目   到#34; Microsoft.Build.Framework.ITaskItem"类型的参数。

所以我在.csproj文件中注释掉了下面显示的itemgroup节点

<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文件时,我收到一个错误。错误详情如下所述。

  

在   System.Deployment.Application.ComponentVerifier.VerifyFileHash(字符串   filePath,Hash hash)at   System.Deployment.Application.ComponentVerifier.VerifyFileHash(字符串   filePath,HashCollection hashCollection)at   System.Deployment.Application.ComponentVerifier.VerifyComponents()             在   System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState   subState,AssemblyManifest deployManifest,AssemblyManifest   appManifest,Uri sourceUriBase,String targetDirectory,String group,   IDownloadNotification通知,下载选项选项)   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,   字符串和放大器; errorPageUrl,Uri&amp; deploymentUri)at   System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(URI   活化

1 个答案:

答案 0 :(得分:1)

您是否使用Visual Studio 2017 15.5或更高版本?

尝试更改:

<AppConfigWithTargetPath Remove="app.config" />

收件人:

<AppConfigWithTargetPath Remove="@(AppConfigWithTargetPath)"/>

我有同样的错误,这篇文章对我有帮助:https://developercommunity.visualstudio.com/solutions/183829/view.html