开发者

Deployment package for a 64-bit windows service in VS2010

开发者 https://www.devze.com 2023-02-05 06:19 出处:网络
I\'m trying to create a deployment package for a windows service targeting x64. I\'ve made the setup project itself target x64 but I need to add custom actions to actually register/unregister the ser

I'm trying to create a deployment package for a windows service targeting x64.

I've made the setup project itself target x64 but I need to add custom actions to actually register/unregister the service.

However, when I add custom actions and try to run the installer, I get a BadFormat exception which indicates that the executable for my service is corrupted.

I suspect I'm running into the issue mentioned here but am unable to prove it.

This windows service is being developed as part of a far larger application using TFS for automated builds and deployment, continuous integration, etc - So manually tweaking bits of a binary file using tools which require the use of a GUI is a definite no-no.

So... What I need to know is; Is it possible to automatically build a deployment package for a 64-bit windows service i开发者_开发问答n VS2010? If so how?


This will happen when either your service or one of the assemblies it uses was built with the Target Platform setting changed to x86. In which case you have to use the right version of Installutil.exe to register the service. There are two, in c:\windows\microsoft.net\framework and \framework64, respectively the 32-bit and the 64-bit version. Odds are good that you need the former. If you created a Setup project then you'd change the TargetPlatform property to x86.

Also check if you really need to have the target platform set, you only do if you have a dependency on unmanaged code like a COM server. The C# setting is in Project + Properties, Compile tab. The default for VS2010 is x86, just flip it to AnyCPU if you have no such dependency.

0

精彩评论

暂无评论...
验证码 换一张
取 消