忽略Visual Studio安装项目快捷参数的变量 [英] Variables in Shortcut Arguments ignored for Visual Studio setup project

查看:148
本文介绍了忽略Visual Studio安装项目快捷参数的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找在一个安装项目卸载替代(在阅读<一个href="http://stackoverflow.com/questions/1356160/in-a-visual-studio-setup-project-how-do-i-generate-an-uninstall-script">this)并试图下面,黯然失败:

我做了一个安装项目在C#中的虚拟应用程序。我说从它生成的输出和Uninstall.bat文件,这里面的:

 回声%1
MSIEXEC / X%1
 

我然后添加到该文件的快捷方式与 [产品code] 在快捷方式的参数字段:

我的理由是,Uninstall.bat将被要求与该产品code(解决)作为参数。<​​/ P>

它的设定,没有骰子后,参​​数不同时,从快捷方式安装程序通过。在命令窗口中的输出是:

ECHO上。
MSIEXEC / X

%1 参数似乎并不present不会。展望二进制编辑器中的LNK文件中,该产品code似乎是present。

这里发生了什么?

有各种争论进一步尝试和一个简单的回声:

  1. [产品code] - >忽略
  2. {%硬codedProduct code%} - >传递给批为%1
  3. [产品名称] - >忽略
  4. 恒[产品code] - >常量只有传递给批为%1
  5. [产品名称]恒[产品code] - >常量只有传递给批为%1 ,不是%2
  6. [产品名称]恒[产品code] [UndeclaredVariable123] - >常量只有传递给批为%1
  7. $ [产品code] - > $ 只传递给批为%1

第五示例显示了变量在某种程度上被忽略,如果不断被碰撞到位置1。

解决方案

首先,为什么要添加$的?

参数在方括号中定义。

设置[产品code]或[产品code]

它应该工作,所有VS参数是一个字,他们没有空间了,没有$符号。

也可以看看这里, <一href="http://www.gogototo.com/how-to-add-a-uninstall-option-in-visual-studio-setup-project-without-writing-$c$c.html" rel="nofollow">http://www.gogototo.com/how-to-add-a-uninstall-option-in-visual-studio-setup-project-without-writing-$c$c.html

I was looking for an alternative for an uninstall in a setup project (while reading this) and tried the following, which sadly fails:

I made a Setup Project for a dummy application in C#. I added the output from its build and an Uninstall.bat file with this inside:

echo %1
msiexec /x %1

I then added a shortcut to that file with [Product Code] in the shortcut's Arguments field:

My rationale was that Uninstall.bat would be called with the product code (resolved) as an argument.

After setting that up, no dice, the argument isn't passed along to the installer from the shortcut. The output from the command window is:

ECHO is on.
msiexec /x

The %1 parameter doesn't seem present. Looking inside the LNK file in a binary editor, the product code appears to be present.

What's happening here?

Further attempts for various arguments and a simple echo:

  1. [Product Code] -> ignored
  2. {%hardcodedProductCode%} -> passed to batch as %1
  3. [Product Name] -> ignored
  4. Constant [Product Code] -> Constant only is passed to batch as %1
  5. [Product Name] Constant [Product Code] -> Constant only is passed to batch as %1, not %2
  6. [Product Name] Constant [Product Code] [UndeclaredVariable123] -> Constant only is passed to batch as %1
  7. $[Product Code] -> $ only is passed to batch as %1

The 5th example shows that variables are ignored somehow if the constant is bumped to position 1.

解决方案

First of all why you are adding $?

Parameters are defined in square brackets.

Set [ProductCode] or [PRODUCTCODE]

It should work, all vs arguments are one word, they do not have spaces an there is no $ sign.

Also have a look here, http://www.gogototo.com/how-to-add-a-uninstall-option-in-visual-studio-setup-project-without-writing-code.html

这篇关于忽略Visual Studio安装项目快捷参数的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆