Visual Studio 2019安装程序项目:如何删除.NET Framework的启动条件 [英] Visual Studio 2019 installer project: how to remove launch condition for .NET Framework

查看:140
本文介绍了Visual Studio 2019安装程序项目:如何删除.NET Framework的启动条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio Installer Projects扩展名在大约10年前的某个时候被删除.来自许多开发人员的抗议导致Microsoft改变了主意,据我所知,该扩展被重新引入,然后保持不变.我已经使用了很长时间-实际上是打包在Visual Studio外部构建的应用程序(即Delphi和Java东西).直到最近,这一直很好.现在,以某种方式检测到.NET Framework 4.7.2的依赖关系,但是我的同事向我保证,不需要它.我无法删除此依赖项.而且我也无法删除关联的启动条件.我什至试图通过从* .vdproj文件中删除一些引用.NET框架的JSON来破解文件,但无济于事.当我向解决方案中添加第二个项目时,我至少能够删除提示用户安装框架的启动条件.我能够像这样保存解决方案.但是:当我单击开始构建过程时,在实际过程开始之前再次添加了启动条件.有人知道我可以使用其他技巧吗?

解决方案

免责声明 :在以下答案之后添加.请略读.


以下是原始答案.似乎阻止了.NET框架与MSI的捆绑,但似乎存在基准检查".无论如何,以获得最低可能"的结果..NET框架的版本.对于Visual Studio 2019,这似乎是.NET 4.6.


右键单击主项目并转到属性,您会看到

  • 现在按先决条件"按钮以获取此对话框:

  • 调整所需的.NET Framework版本-或删除依赖项.

  • 请注意,这是由setup.exe启动器完成的,而不是由MSI完成的.您应该能够运行MSI本身或setup.exe启动器.后者将安装指定的.NET框架(如果缺少),而不应单独安装MSI.


    链接:

    The extension Visual Studio Installer Projects was dropped at some point - about 10 years ago. Protests from many developers caused Microsoft to change its mind and the extension was reintroduced and then left unchanged as far as I know. I have worked with it for a long time - actually to package applications built outside Visual Studio (i.e. Delphi and Java stuff). This worked well until recently. Now a dependency is somehow detected for .NET Framework 4.7.2, but my colleagues assured me that it is not needed. I cannot remove this dependency. And I could not remove the associated launch condition either. I even tried to hack the *.vdproj file by removing some JSON from it that referred to the .NET framework, but to no avail. When I added a second project to the solution, I was able to at least remove the launch condition that would prompt the user to install the framework. I was able to save the solution like that. However: when I clicked to start the build process, the launch condition was added again before the actual process started. Does anybody know any other trick which I could use?

    解决方案

    Disclaimer: Added after the below answer. Please skim. Strongly recommend you consider a more capable and transparent MSI tool (no surprises like these) if you plan to keep delivering your software. Just for the record: 1) Problem list VS Installer projects. 2) Even longer list.

    1. I am not sure what the custom action CheckFX does. You might need to disable this custom action too. Update: After more testing I think you should leave this action in.

    2. There are also two interesting properties in the Property table:

      • VSDFrameworkVersion = v4.6.1
      • VSDAllowLaterFrameworkVersions = False

    These properties might be possible to manipulate to change the behavior of the custom actions mentioned below. Particularly the VSDAllowLaterFrameworkVersions looks interesting. Try setting it to "True" and test on your target platforms? My quick test seemed ineffective.


    Overall Recommendation: The summary of it all is that 1) I suggest you use a better tool if you need this to work properly in the future without "black box surprises" (you don't know how things really work). 2) The "solution" to disable the VSDCA_VsdLaunchConditions custom action as described below should work though. 3) Please test thoroughly on all target OS versions. Remember upgrade scenarios and uninstall. 4) You could try those properties in the property table (VSDFrameworkVersion, VSDAllowLaterFrameworkVersions). Various settings. I didn't discover anything in particular after a smoke test.


    Prerequisites: The first proposed solution I added (at the bottom of this answer now) will remove the dependency on the .NET framework to look at, but it seems there is a custom action in the MSI which will check for the baseline .NET version anyway. It is called: VSDCA_VsdLaunchConditions.

    Hack MSI: To prevent any checks for the .NET framework you can hack the MSI as follows:

    1. Open your MSI with Orca.
    2. In the InstallExecuteSequence table locate VSDCA_VsdLaunchConditions and change its condition by adding: "AND 0" to what is there already. This will prevent the custom action from running at all.
    3. Continue in the InstallUISequence table. Locate VSDCA_VsdLaunchConditions and change its condition by adding: "AND 0" to what is there already.
    4. Save the MSI and do a test install on a box without recent versions of the .NET framework (some are built-in on most OS versions now).

    Always False Condition: AND 0 makes the condition for the sequence custom action always false - which means it never runs. You can also delete the custom action itself, but that would generate some dangling foreign keys - this approach should not do so.

    MSI Tables: The InstallExecuteSequence table runs the installation. The InstallExecuteSequence table runs the setup GUI - both locations must be modified to prevent any .NET checks.

    Consequences: Side-effects of this approach should be minimal (unless your application really does require a specific, higher version of the .NET framework), but I don't know what else goes on in that custom action.

    Custom Action DLL: The actual custom action binary inside the VS Installer Project seems to be capable of a lot of things, but this functionality should inject other custom actions than the above dependency custom action. Looking at the exported functions of the dll it seems most calls relate to IIS functionality:


    Below is the original answer. It seems to prevent the bundling of .NET frameworks with your MSI, but it seems there is a "baseline check" anyway for a "lowest possible" version of the .NET framework. For Visual Studio 2019 this seems to be .NET 4.6.


    When you right click the main project and go properties do you see the "Prerequisites" dialog as shown here? Here you can change what prerequisites your setup bundles:

    1. In the top left corner, select your "Release" configuration.

    2. Now press the "Prerequisites" button to get this dialog:

    3. Adjust the required version of the .NET framework - or remove the dependency.

    Note that this is done by the setup.exe launcher and not the MSI it seems. You should be able to run the MSI itself or the setup.exe launcher. The latter will install the .NET framework specified (if missing), and the MSI installed on its own should not.


    Links:

    这篇关于Visual Studio 2019安装程序项目:如何删除.NET Framework的启动条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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