简体   繁体   English

Visual Studio Installer项目 - 脚本错误

[英]Visual Studio Installer Project - Script error

I'm creating my first installer through the built-in deployment project. 我正在通过内置部署项目创建我的第一个安装程序。 My application uses the HTTPListener library which requires Admin privileges. 我的应用程序使用需要Admin权限的HTTPListener库。 To get around this I've read several posts saying you need to add the URL through netsh. 为了解决这个问题,我已经阅读了几篇帖子,说你需要通过netsh添加URL。 So I created a basic vbs script to add the permissions to be ran during the install of the applications so admin privileges aren't actually required to run the application, only install it. 因此,我创建了一个基本的vbs脚本来添加在安装应用程序期间运行的权限,因此实际上不需要管理员权限来运行应用程序,只需安装它。 The problem is when i try to include the script in the install project, build the msi and run it i get the following error: 问题是当我尝试在安装项目中包含脚本时,构建msi并运行它我得到以下错误:

在此输入图像描述

My current vbs script is: 我目前的vbs脚本是:

Set oshell = WScript.CreateObject("WScript.Shell")
oshell.run "cmd.exe /C netsh http add urlacl url=http://+:1234/localhost/ user=everyone && netsh http add urlacl url=http://+:1234/ user=everyone"

The current project setup with custom actions looks as follows: 使用自定义操作的当前项目设置如下所示: 在此输入图像描述

I've tried putting the vbs script in both the "install" and "commit" actions with no success. 我已经尝试将vbs脚本放在“安装”和“提交”操作中但没有成功。

Any aid would be immensely appreciated. 任何援助都将受到极大的赞赏。 It could just be something obvious with the vbs file I'm missing too as I haven't done vbs. 它可能只是显而易见的vbs文件我也很遗憾,因为我没有做过vbs。

You cannot use WScript.CreateObject in a custom action. 您不能在自定义操作中使用WScript.CreateObject。 The WScript object is an object model supplied when your script is run with Windows Script Host, and you are not in that environment. WScript对象是使用Windows脚本宿主运行脚本时提供的对象模型,并且您不在该环境中。 I don't think you even need it - just try CreateObject. 我认为你甚至不需要它 - 只需尝试CreateObject。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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