问题描述
我的目的是能够通过命令行或在Visual Studio中使用任何包装器用于C#应用程序和库(偏爱WPF).
我来了.并在使用WPF应用程序测试之前工作得很好:
PackageExample.Program -> C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Program.exe COMMAND: packcompress\netz-bin-40\netz.exe -o PackageExample.Program\bin\Debug\Packed -pl anycpu -s -z PackageExample.Program\bin\Debug\PackageExample.Program.exe "PackageExample.Program\bin\Debug\*.dll" -d:@ -v __________________________________________ | | | .NETZ - .NET Executables Compressor | | Copyright (C) 2004-2013 Vasian Cepa | | [v0.4.8] http://madebits.com | |__________________________________________| PE subsystem : GUI .NET Runtime : 4.0.30319.18052 Output directory: C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\Packed RID: zip.dll Added : C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\packcompress\netz-bin-40\zip.dll [65536 byte(s) ~ 64KB] Processing : 3 file(s) 1| C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Program.exe [255488 byte(s) ~ 249KB] -> [130850 byte(s) ~ 127KB] - 49% RID: A6C24BF5-3690-4982-887E-11E1B159B249 2| C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Lib1.dll [4096 byte(s) ~ 4KB] -> [1577 byte(s) ~ 1KB] - 62% RID: PackageExample.Lib1!2!1Version=1.0.0.0!2!1!4=neutral!2!1PublicKeyToken=null 3| C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Lib2.dll [4608 byte(s) ~ 4KB] -> [1617 byte(s) ~ 1KB] - 65% RID: PackageExample.Lib2!2!1Version=1.0.0.0!2!1!4=neutral!2!1PublicKeyToken=null Done [00:00:00.300]
包装应用程序抛出以下内容: http://i.imagebanana.com/img/251ygj82/unbenannt.png (找不到ressource mainwindow.xaml.)
问题似乎是xaml .netz混淆了,但是我发现有些人在互联网上工作,但我没有任何问题解决方案.
在这种情况下,您可以帮助我吗?
附加信息:提到我什至尝试使用.NET 2.0 .NETZ构建.NET 3.5 WPF应用程序.
可能很有趣.推荐答案
我也使用Netz遇到问题,将WPF 4.0 EXE和DLL压缩为单个EXE. 我的app.xml.cs将开始运行,但随后将抛出对notimplempledexception的UnhandledException: BAML2006SCHEMACONTEXT.RESOLVEBAMLTYPE ...
为了解决此问题,我运行了fuslogvw.exe查看汇编绑定错误,并发现Galasoft.mvvmlight.wpf4.dll未能从Netz包装的汇编中加载. 然后,我切换到netz.exe从源编译并再次尝试. 经过重复实验后,我看到如果我重新编译并将其包装到该应用程序中,有时会开始工作.再次重新编译主应用程序,Netz生产一个失败的应用程序. 换句话说,某事是断断续续的. 对不起,这不是一个好消息 - 要么尝试另一种包装方案,要么在许多构建中反复尝试Netz,直到您找到一个工作.
问题描述
My aim is to be able to use any packer for C# applications and libraries (preferring WPF) via command line or full build-in at Visual Studio.
I came accross .NetZ (http://madebits.com/netz/) that is pretty neat and worked pretty well until I tested it with a WPF application:
PackageExample.Program -> C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Program.exe COMMAND: packcompress\netz-bin-40\netz.exe -o PackageExample.Program\bin\Debug\Packed -pl anycpu -s -z PackageExample.Program\bin\Debug\PackageExample.Program.exe "PackageExample.Program\bin\Debug\*.dll" -d:@ -v __________________________________________ | | | .NETZ - .NET Executables Compressor | | Copyright (C) 2004-2013 Vasian Cepa | | [v0.4.8] http://madebits.com | |__________________________________________| PE subsystem : GUI .NET Runtime : 4.0.30319.18052 Output directory: C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\Packed RID: zip.dll Added : C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\packcompress\netz-bin-40\zip.dll [65536 byte(s) ~ 64KB] Processing : 3 file(s) 1| C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Program.exe [255488 byte(s) ~ 249KB] -> [130850 byte(s) ~ 127KB] - 49% RID: A6C24BF5-3690-4982-887E-11E1B159B249 2| C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Lib1.dll [4096 byte(s) ~ 4KB] -> [1577 byte(s) ~ 1KB] - 62% RID: PackageExample.Lib1!2!1Version=1.0.0.0!2!1!4=neutral!2!1PublicKeyToken=null 3| C:\Users\[username]\Documents\Visual Studio 2012\Projects\PackageExample\PackageExample.Program\bin\Debug\PackageExample.Lib2.dll [4608 byte(s) ~ 4KB] -> [1617 byte(s) ~ 1KB] - 65% RID: PackageExample.Lib2!2!1Version=1.0.0.0!2!1!4=neutral!2!1PublicKeyToken=null Done [00:00:00.300]
The packed app throws this: http://i.imagebanana.com/img/251ygj82/Unbenannt.PNG (The ressource mainwindow.xaml cannot be found.)
The problem seems to be the xaml .NetZ confuses, but I found some people who got it working on the internet, but I do not get any problem solution.
Are you able to help me in this case?
Additional information: It might be interesting to mention I even tried this with the .NET 2.0 .NetZ build on a .NET 3.5 WPF application.
推荐答案
I also had problems using NetZ to compress an WPF 4.0 exe and DLLs into a single exe. My app.xml.cs would start to run, but then an UnhandledException of type NotImplementedException would be thrown: Baml2006SchemaContext.ResolveBamlType ...
To troubleshoot this, I ran fuslogvw.exe to see assembly binding errors, and discovered that GalaSoft.MvvmLight.Wpf4.dll was failing to load from the Netz-packed assembly. I then switched to NetZ.exe compiled from source and tried again. After repeated experimentation, I see that if I recompile and NetZ-pack the app, it sometimes starts working. Recompile again the main app again, and NetZ produces a failing app. In other words, something is intermittent. Sorry for the not-so good news - either try another packing scheme, or try NetZ repeatedly on many builds, until you find a working one.