Why the shortcut created by my MSI install start the setup process again each time?

MSI comes with an auto-repair feature that checks whether all components installed by MSI are still present when you launch your application using the shortcut.

In your case, probably one (or more) components have been removed so the installer is launched again to repair your installation.

To prevent auto-repair from running either

  • Make sure no file, registry setting or other installed component is removed

or

  • Don't set the key path for those components. That will prevent MSI from checking those specific components

From your other questions it seems that your MSI has been created by a Visual Studio Setup and Deployment Project. Unfortunately, there is no option to modify the key path from within Visual Studio. You have the following options:

  • Modify the MSI manually using Orca (This is not a good option because it is a manual step) (Property = 'DISABLEADVTSHORTCUTS' Value = '1'
  • Write a script e.g. using VBScript to patch the MSI file
  • Move to a more advanced install system which gives you more control such as WiX or NSIS
  • msiexec /i <msi file> DISABLEADVTSHORTCUTS=1. 
一个好的解决方法是,在Visual Studio中在一个Custom UI dialog中override "DISABALEADVTSHORTCUTS"的值。

Here is how I did it:

  1. Open the User Interface for your Deployment project (with the deployment project active choose View>Editors>User Interface).
  2. Select the "Start" section of the User Interface and then from the action menu choose "Add Dialog" and add a "Textboxes" dialog.
  3. In the properties pain for the Textboxes dialog set the BannerBitmap, BannerText, and BodyText properties to something informative to the user running the install (the user will never know that this dialog is doing something behind the scenes).
  4. Set the following properties for the Textboxes dialog:
    • Edit1Property: DISABLEADVTSHORTCUTS
    • Edit1Value: 1
    • Edit1Visible: false
    • Edit2Visible: false
    • Edit3Visible: false
    • Edit4Visible: false

That’s it. When windows installer gets to that dialog and the user clicks "Next" it will insert the property DISABLEADVTSHORTCUTS = 1 into the property table and so when the actual install occurs standard windows shortcuts will be used instead of advertised shortcuts.

Note: Due to the advantages of advertised shortcuts I recommend using the default setting if it will work in your situation. Only use this work-around if you have some reason to need standard shortcuts.


MSI默认提供的是Advanced Short-cuts.
One advantage of advertised shortcuts is you can have certain features be installed on demand, and I think missing files can also be repaired if I'm not mistaken. The downside as a user that I hate is I sometimes want to find out where the executable is and which executable is run and it's harder to find that out.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在卷积神经网络中,shortcut连接也被称为残差连接,用于提高网络训练的速度和准确性。在PyTorch中,可以使用`nn.ModuleList`和`nn.Sequential`模块来实现shortcut连接。 具体而言,可以定义一个包含多个卷积层的模块,然后将该模块作为主网络的一部分,并添加shortcut连接。下面是一个使用PyTorch实现shortcut连接的示例代码: ```python import torch import torch.nn as nn class ResidualBlock(nn.Module): def __init__(self, in_channels, out_channels, stride=1): super(ResidualBlock, self).__init__() self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(out_channels) self.relu = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=False) self.bn2 = nn.BatchNorm2d(out_channels) # 添加shortcut连接 if stride != 1 or in_channels != out_channels: self.shortcut = nn.Sequential( nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False), nn.BatchNorm2d(out_channels) ) else: self.shortcut = nn.Sequential() def forward(self, x): out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) out += self.shortcut(x) # 添加shortcut连接 out = self.relu(out) return out ``` 在这个示例中,`ResidualBlock`是一个包含两个卷积层的模块,其中第二个卷积层的输出和shortcut连接的输出相加。如果输入和输出通道数不同或者stride不为1,那么就需要在shortcut连接中添加一个额外的1x1卷积层和BN层来保证通道数和尺寸的一致性。最后,在`forward`函数中,将shortcut连接的输出加到卷积层的输出上,然后再通过ReLU激活函数进行非线性变换。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值