开发者

What is the best way to refer to 'external' files that need to be bundled in a Visual Studio (2008) solution for debugging and deployment?

开发者 https://www.devze.com 2023-01-23 15:13 出处:网络
I am trying to build a Windows service that launches a webserver (Nginx) before login on a Windows computer. This needs to be bundled with the install.

I am trying to build a Windows service that launches a webserver (Nginx) before login on a Windows computer. This needs to be bundled with the install.

I can find out where the working directory of the windows service is by outputting to a the log the working directory (in this case C:\WINDOWS\System32) and copy over Nginx directory into that folder but this is not great for when it comes to bundling the application into a setup.exe file which may be installed in any arbitrary location - plus it clutters the Syste开发者_运维问答m32 folder

What is the best way to refer to a set 'external' files both during debugging (i.e. within the solution folder hierarchy) and so that the paths will still work after deployment?


What I normally do is make sure they are in the same folder as the executable. When debugging, you can force this by setting the Copy to output directory flag in the properties pane for the files you require. When installing, simply make sure that all files are installed in the same folder. The installer should be able to take care of this.

0

精彩评论

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

关注公众号