简体   繁体   中英

Windows service installation error

I was getting below mentioned error whenever i tried to publish this windows service

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".

So I commented out itemgroup node shown below in .csproj file

<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>

So i got rid of the error mentioned above and i was able to publish the windows service in a folder.. Now when i try to run setup.exe file i get an error. Error details are mentioned below.

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

Do you use Visual Studio 2017 version 15.5 or higher?

Try to change:

<AppConfigWithTargetPath Remove="app.config" />

To:

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

I had the same error and this post helped me: https://developercommunity.visualstudio.com/solutions/183829/view.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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