Как преобразовать простой консольный проект a .NET в портативный exe с Моно и mkbundle?

В то время как у меня нет всех браузеров для тестирования этого в, появляется, как будто большинство принимает просто определение, что высота должна работать.

я протестировал это в Internet Explorer 7 и Firefox 3.0.

Просто используют следующий код:

<textarea style="height: 50%; width: 80%;">Your text here</textarea>

, С каким браузером (браузерами) у Вас были проблемы?

14
задан Community 23 May 2017 в 12:16
поделиться

1 ответ

I have found a simple how-to here, however, as I have not tested it myself, I cannot guarantee results. As usual YMMV.

Quote from the original article (please follow the thread on the original article as well though):

Mkbundle: bundle Mono with your applications

Did you ever wonder why you need .NET Framework or Mono installed to run your program? Well, it would be much more handy if you could distribute your applications without nagging your clients to install additional frameworks, is it not? So here we are. Lets bundle a .NET-based application with Mono, so you don't need Mono, or .NET installed to run it.

Prepare an environment

First you need to install newest Mono and Cygwin. Installing Mono is very straightforward so you cannot screw up anything. When you start installing Cygwin, go into Full view, then please include 4 additional packages. These are: gcc, mingw, mingw-zlib and zlib.

Now you need a command prompt. Both Mono and Cygwin create shortcuts for command prompts on your desktop, but you need to combine them into one. Here is a batch that does it for me. You may need to change it, if you have other Mono version for example.

Code:

echo Mono version 2.4 Build 6
echo Prepending 'C:\PROGRA~1\Mono-2.4\bin' to PATH
PATH=C:\PROGRA~1\Mono-2.4\bin;%PATH%

chdir C:\cygwin\bin
bash --login -i

Bundle an application with Mono

So we are now in a command prompt, running this Cygwin mode. Notice that this is not a DOS prompt anymore, and "dir" won't work anymore. To list files use linux command "ls". The folder you are browsing now is like the one below. Arek is a username. Code:

C:\cygwin\home\Arek

Browse to this folder with your explorer. Now you copy 2 files into this folder. 1st is your application exe and 2nd is the file Mono.dll (2MB) that you can find in your Mono folder. Code:

C:\Program Files\Mono-2.4\bin

По какой-то причине вся процедура не работает с длинными именами файлов, поэтому переименуйте приложение в exe. Он должен соответствовать старому названию DOS 8.3.

Вернемся к командной строке. Вам понадобится всего одна команда для объединения вашего приложения, и вот некоторые пояснения:

mkbundle - это программа в пакете Mono | -o Bundled1.exe указывает, как будет называться исполняемый файл в пакете Mono | Winform1.exe говорит, что будет включено, библиотеки Mono все равно будут включены | --deps необходим, хотя я не уверен, что он делает | -z сильно сжимает выходной файл exe

Код:

 mkbundle -o Bundled1.exe Winform1.exe --deps -z

So now you got your Bundled1.exe, which contains your own app along with Mono itself. You should not need Mono nor .NET to run it. Notice that it will be 4MB or more in size. Those bundled exes are not lightweight.

16
ответ дан 1 December 2019 в 13:59
поделиться
Другие вопросы по тегам:

Похожие вопросы: