开发者

How do I Include a Powershell script when publishing my VB app?

I am writing an application in VB.NET. In the app, I have a function which calls a Powershell script and places the resulting information in a text box.

I have two issues:

How to I ensure that when my app is开发者_运维百科 published, the powershell script is included? How do I reference the script in my code?

Currently, I simply give my function the full path to the script, which is in a folder on my Desktop. Obviously, this will not work once I deploy the app to other computers.


You will need to create a Setup project to get your script in place on your target system.

A first step is to change the Build Action to Content and Copy to Output Directory to Copy always.

Your Setup project can pick up the script from the VB app build result and put it in place when installing your app.

As for your question concerning the user configurable install path: The easiest way to handle this would be to add registry entry containing the selected program file path and have your app read the path from there.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜