C# 从 WinForms 应用程序中删除 ClickOnce
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/923607/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove ClickOnce from a WinForms app
提问by Ryan Lundy
I have a WinForms application that was going to use ClickOnce. But it turns out ClickOnce won't work for my application, so I'd like to remove it. Only...there doesn't seem to be an obvious way to do this. There's no "Un-ClickOnce" button. Does anybody know what steps I need to take to get my app to be like it was before ClickOnce integrated itself?
我有一个要使用 ClickOnce 的 WinForms 应用程序。但事实证明 ClickOnce 不适用于我的应用程序,所以我想删除它。只是……似乎没有明显的方法可以做到这一点。没有“Un-ClickOnce”按钮。有谁知道我需要采取哪些步骤才能使我的应用程序与 ClickOnce 集成之前一样?
(I know I can create a new project and import stuff into it, but it seems silly to have to do that, so I'm hoping there's another way.)
(我知道我可以创建一个新项目并将内容导入其中,但必须这样做似乎很愚蠢,所以我希望有另一种方法。)
采纳答案by Chris Rogers
Other responses here are not correct or helpful. It is incorrect to state that it never needs removing.
此处的其他回复不正确或有帮助。说它永远不需要移除是不正确的。
One such example I experienced recently was when the application had a need for administrative privileges. Any attempt to embed administrative requirements into the manifest will result in the application not even compiling while ClickOnce is still present in the solution.
我最近遇到的一个这样的例子是当应用程序需要管理权限时。任何将管理要求嵌入清单的尝试都将导致应用程序甚至无法编译,而 ClickOnce 仍存在于解决方案中。
The following two steps enabled me to turn off ClickOnce (in Visual Studio 2010):
以下两个步骤使我能够关闭 ClickOnce(在 Visual Studio 2010 中):
In the project properties,
在项目属性中,
- Signingtab: Untick "Sign the ClickOnce manifests"
- Securitytab: Untick "Enable ClickOnce security settings"
- 签名选项卡:取消勾选“签署 ClickOnce 清单”
- 安全选项卡:取消勾选“启用 ClickOnce 安全设置”
回答by Brandon Grossutti
I believe the only thing that is left from ClickOnce once you stop deploying it is file publish.xml
that tells you about what you have deployed thus far and what version you are at. Otherwise there is really nothing there that need concern you, just deploy from the bin
folders as you would without ClickOnce.
我相信,一旦您停止部署 ClickOnce,它唯一剩下的publish.xml
就是告诉您到目前为止已部署的内容以及您所处的版本的文件。否则真的没有什么需要您担心的,只需bin
像没有 ClickOnce 一样从文件夹中部署即可。
回答by andyhammar
I agree with the others, there is no need to "remove ClickOnce".
我同意其他人的看法,没有必要“删除 ClickOnce”。
If you are really going for it though, IIRC all ClickOnce settings are in the .csproj file for the project, so remove all XML tags there that relate to ClickOnce. (maybe easiest to compare to a new app that hasn't been deployed with CO ever to see what tags are not there)
不过,如果您真的要这样做,IIRC 的所有 ClickOnce 设置都在项目的 .csproj 文件中,因此请删除那里与 ClickOnce 相关的所有 XML 标记。(可能最容易与尚未使用 CO 部署的新应用程序进行比较,以查看哪些标签不存在)
回答by Gabriel Diaconescu
If you refer the the ClickOnce Application Deployment Manifest files that appear in your Debug folder, go to Project Properties -> Security and uncheck 'Enable ClickOnce Security Settings'
如果您参考 Debug 文件夹中出现的 ClickOnce 应用程序部署清单文件,请转到项目属性 -> 安全性并取消选中“启用 ClickOnce 安全设置”
You can also go to Project Properties -> Signing and uncheck 'Sign the ClickOnce manifests', but this is not necessary because it does not have what to sign if you do the first uncheck.
您还可以转到 Project Properties -> Signing 并取消选中“Sign the ClickOnce manifests”,但这不是必需的,因为如果您第一次取消选中它就没有要签名的内容。
Now if you go to debug and delete .application files, at rebuild, there will not appear again.
现在如果你去调试和删除 .application 文件,在重建时,不会再出现。
回答by TonyT_32909023190
Just in case this helps anyone...
以防万一这有助于任何人......
My problem was specifically that I had a dependant "Class Library" project that had the "sign the clickonce manifest" checked but disabled so it could not be unchecked. My solution was to:
我的问题特别是我有一个依赖的“类库”项目,该项目已选中“签署 clickonce 清单”但已禁用,因此无法取消选中。我的解决方案是:
- Convert that project to a windows app,
- Re-open the properties panel,
- Remove the click once manifest signing from the signing tab on the properties panel,
- Convert the project back to a "Class Library".
- 将该项目转换为 Windows 应用程序,
- 重新打开属性面板,
- 从属性面板上的签名选项卡中删除单击一次清单签名,
- 将项目转换回“类库”。
I consider it an MS bug (still in VS2019 16.0.1 which I'm using now) but the workaround fixed it.
我认为这是一个 MS 错误(仍然在我现在使用的 VS2019 16.0.1 中)但解决方法修复了它。
Good Luck!
祝你好运!