Jan*_*net 1 c# windows-installer build visual-studio-setup-proje visual-studio-2019
我在 VS2019 Enterprise 中构建的解决方案中有一个 C# 项目,使用 .NET 4.8,由于这是一个仅供内部使用的工具,1)我将发布的构建日志将被编辑,2)我完全知道将运行它的每台计算机的硬件和 .NET 版本,因为它们都与我自己的完全相同。
该程序集使用硬件密钥进行签名,因为我们使用白名单来确定哪些内容可以在所述笔记本电脑上运行,哪些内容不能运行(因此我必须在本地构建它),并且由于该工具的内存需求,我仅构建了 x64。(是的,我看过它运行,是的,它使用了超过 2GB 的 RAM,不,我对此无能为力。你只需要相信我的话。)
综上所述,我安装了 Microsoft 制造的扩展程序来尝试创建 MSI 安装程序,因为这需要尽可能易于安装,但它一直失败。下面输出。
1>------ Rebuild All started: Project: MyCSProject, Configuration: Release x64 ------
1> MyCSProject -> C:\dev\Source\Repos\MySolution\MyCSProject\bin\x64\Release\MyCSProject.exe
1> Done Adding Additional Store
1> Successfully signed: C:\dev\Source\Repos\MySolution\MyCSProject\bin\x64\Release\MyCSProject.exe
1>
------ Starting pre-build validation for project 'MyCSProject Setup' ------
------ Starting pre-build validation for project 'MyCSProject Setup' ------
------ Starting pre-build validation for project 'MyCSProject Setup' ------
WARNING: Unable to find dependency 'MICROSOFT.WINDOWSAPICODEPACK' (Signature='(null)' Version='1.1.0.0') of assembly 'Microsoft.WindowsAPICodePack.Shell.dll'
WARNING: Unable to find dependency 'MICROSOFT.WINDOWSAPICODEPACK' (Signature='(null)' Version='1.1.0.0') of assembly 'Microsoft.WindowsAPICodePack.Shell.dll'
WARNING: Unable to find dependency 'MICROSOFT.WINDOWSAPICODEPACK' (Signature='(null)' Version='1.1.0.0') of assembly 'Microsoft.WindowsAPICodePack.Shell.dll'
------ Pre-build validation for project 'MyCSProject Setup' completed ------
------ Pre-build validation for project 'MyCSProject Setup' completed ------
------ Pre-build validation for project 'MyCSProject Setup' completed ------
2>------ Rebuild All started: Project: MyCSProject Setup, Configuration: Release ------
2>------ Rebuild All started: Project: MyCSProject Setup, Configuration: Release ------
2>------ Rebuild All started: Project: MyCSProject Setup, Configuration: Release ------
Building file 'C:\dev\Source\Repos\MySolution\MyCSProject Setup\Release\MyCSProject Setup.msi'...
Building file 'C:\dev\Source\Repos\MySolution\MyCSProject Setup\Release\MyCSProject Setup.msi'...
Building file 'C:\dev\Source\Repos\MySolution\MyCSProject Setup\Release\MyCSProject Setup.msi'...
WARNING: Xml validation did not pass for item 'Microsoft .NET Framework 4.8 (x86 and x64)' located at 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml'.
WARNING: Xml validation did not pass for item 'Microsoft .NET Framework 4.8 (x86 and x64)' located at 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml'.
WARNING: Xml validation did not pass for item 'Microsoft .NET Framework 4.8 (x86 and x64)' located at 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml'.
WARNING: Xml Validation error in file 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml': The element 'InstallConditions' in namespace 'http://schemas.microsoft.com/developer/2004/01/bootstrapper' cannot contain text. List of possible elements expected: 'http://schemas.microsoft.com/developer/2004/01/bootstrapper:BypassIf http://schemas.microsoft.com/developer/2004/01/bootstrapper:FailIf'.
WARNING: Xml Validation error in file 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml': The element 'InstallConditions' in namespace 'http://schemas.microsoft.com/developer/2004/01/bootstrapper' cannot contain text. List of possible elements expected: 'http://schemas.microsoft.com/developer/2004/01/bootstrapper:BypassIf http://schemas.microsoft.com/developer/2004/01/bootstrapper:FailIf'.
WARNING: Xml Validation error in file 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml': The element 'InstallConditions' in namespace 'http://schemas.microsoft.com/developer/2004/01/bootstrapper' cannot contain text. List of possible elements expected: 'http://schemas.microsoft.com/developer/2004/01/bootstrapper:BypassIf http://schemas.microsoft.com/developer/2004/01/bootstrapper:FailIf'.
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
ERROR: File 'MyCSProject.exe' of project output 'Primary output from MyCSProject (Active)' targeting 'AMD64' is not compatible with the project's target platform 'x86'
ERROR: File 'MyCSProject.exe' of project output 'Primary output from MyCSProject (Active)' targeting 'AMD64' is not compatible with the project's target platform 'x86'
ERROR: File 'MyCSProject.exe' of project output 'Primary output from MyCSProject (Active)' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'MyCSProject.exe' of project output 'Primary output from MyCSProject (Active)' targeting 'x64' is not compatible with the project's target platform 'x86'
WARNING: File 'MyCSProject.exe' of project output 'Primary output from MyCSProject (Active)' targeting 'x64' is not compatible with the project's target platform 'x86'
WARNING: File 'MyCSProject.exe' of project output 'Primary output from MyCSProject (Active)' targeting 'x64' is not compatible with the project's target platform 'x86'
Build process cancelled
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)
(如果我可以指定一种语言可以使构建日志更易于阅读,无论如何,请告诉我。我也可以发布Product.xml日志中提到的内容,但由于它有 97 行长,我赢了除非必要。)
旁注,我什至没有使用任何 HTTP,(这严格来说是一个 Windows 窗体程序,)所以我根本不知道为什么system.net.http.dll要包含它。该工具仍在开发中,所以在完成之前我必须重新构建几次,毫无疑问,但我只是想以一种我可以在他们的笔记本电脑上使用的格式来获得这个东西,因为我们遍及全国。
那为什么不建设呢?我发现这方面的文档很少,尤其是最近的任何文档。 应该发生什么,正如前几行所示,应该构建一个 MSI 来安装我的 exe 和任何无法转入 EXE 的 DLL。
(FWIW,我也试过在 VS 中使用 Publish 选项,但后来它抱怨格式错误的 .manifyingt,它仍然没有创建我正在寻找的“一劳永逸”的安装程序。)
Gonzix 的回答消除了错误,但我仍然有一些警告。这些有什么大不了的?我可以按原样安全地部署,还是需要做其他事情?
WARNING: Unable to find dependency 'MICROSOFT.WINDOWSAPICODEPACK' (Signature='(null)' Version='1.1.0.0') of assembly 'Microsoft.WindowsAPICodePack.Shell.dll'
------ Pre-build validation for project 'MyCSProject Setup' completed ------
2>------ Rebuild All started: Project: MyCSProject Setup, Configuration: Release ------
Building file 'C:\dev\Source\Repos\MySolution\MyCSProject Setup\Release\MyCSProject Setup.msi'...
WARNING: Xml validation did not pass for item 'Microsoft .NET Framework 4.8 (x86 and x64)' located at 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml'.
WARNING: Xml Validation error in file 'C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\product.xml': The element 'InstallConditions' in namespace 'http://schemas.microsoft.com/developer/2004/01/bootstrapper' cannot contain text. List of possible elements expected: 'http://schemas.microsoft.com/developer/2004/01/bootstrapper:BypassIf http://schemas.microsoft.com/developer/2004/01/bootstrapper:FailIf'.
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
WARNING: Two or more objects have the same target location ('[targetdir]\system.runtime.dll')
Run Code Online (Sandbox Code Playgroud)
我主要担心的是一些决斗 DLL 情况,即最终用户的计算机不知何故变得混乱,或者导致执行白名单的工具尖叫。我知道我的笔记本电脑配置为该工具的尖叫声更少,(否则 VS 永远不会运行,)所以我希望有零警告,而不仅仅是零错误......
TL; DR是我仍然遇到问题的警告吗?在什么情况下它们会成为问题?
SIR*_*IRS 23
如果有人仍然需要它,xml 中有一个错字,您需要删除文件-第 45 行的字符C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\DotNetFX48\Product.xml。
| 归档时间: |
|
| 查看次数: |
2256 次 |
| 最近记录: |