Я не могу скомпилировать свое приложение как один исполняемый файл.C#

Место общения программистов C#
Ответить
Anonymous
 Я не могу скомпилировать свое приложение как один исполняемый файл.

Сообщение Anonymous »

Я пытаюсь скомпилировать свое приложение C# как однофайловый исполняемый файл. Я могу его скомпилировать, но если я перенесу исполняемый файл в любое другое место, кроме папки сборки, он не запустится и выдаст ошибку.
Я следовал всем советам, которые мог найти в Google. . Теперь мой файл .csproj выглядит так:



Exe
net8.0
enable
enable
true
true
true
true
linux-x64




И команда компиляции выглядит так:
dotnet publish -c Release -p:PublishReadyToRun=true

Тогда я могу начать с
rpr@latita:~/MyApp$ ./bin/Release/net8.0/linux-x64/MyApp
Hello, World!

Но если я скопирую этот файл с помощью команды cp ./bin/Release/net8.0/linux-x64/MyApp ~/MyAppExecutable, а затем запущу его с помощью команды ~/ MyAppExecutable отображается следующая ошибка:

Приложение для выполнения не существует: ' / h o m e / r p r / M y A p p . d l l ' . < / p > < b r / > < / b l o c k q u o t e > < b r / > К а к и с п р а в и т ь о ш и б к у о т с у т с т в у ю щ е й D L L и с о з д а т ь о д н о ф а й л о в ы й и с п о л н я е м ы й ф а й л ? < / p > < b r / > В о т с о д е р ж и м о е п у б л и к а ц и и к а т а л о г ( < c o d e > / h o m e / r p r / M y A p p / b i n / R e l e a s e / n e t 8 . 0 / l i n u x - x 6 4 / < / к о д > ) : < / p > < b r / > < c o d e > / h o m e / r p r / M y A p p / b i n / R e l e a s e / n e t 8 . 0 / l i n u x - x 6 4 < b r / > ├ ─ ─ c r e a t e d u m p < b r / > ├ ─ ─ l i b c l r g c . s o < b r / > ├ ─ ─ l i b c l r j i t . s o < b r / > ├ ─ ─ l i b c o r e c l r . s o < b r / > ├ ─ ─ l i b c o r e c l r t r a c e p t p r o v i d e r . s o < b r / > ├ ─ ─ l i b h o s t f x r . s o < b r / > ├ ─ ─ l i b h o s t p o l i c y . s o < b r / > ├ ─ ─ l i b m s c o r d a c c o r e . s o < b r / > ├ ─ ─ l i b m s c o r d b i . s o < b r / > ├ ─ ─ l i b S y s t e m . G l o b a l i z a t i o n . N a t i v e . s o < b r / > ├ ─ ─ l i b S y s t e m . I O . C o m p r e s s i o n . N a t i v e . s o < b r / > ├ ─ ─ l i b S y s t e m . N a t i v e . s o < b r / > ├ ─ ─ l i b S y s t e m . N e t . S e c u r i t y . N a t i v e . s o < b r / > ├ ─ ─ l i b S y s t e m . S e c u r i t y . C r y p t o g r a p h y . N a t i v e . O p e n S s l . s o < b r / > ├ ─ ─ M i c r o s o f t . C S h a r p . d l l < b r / > ├ ─ ─ M i c r o s o f t . V i s u a l B a s i c . C o r e . d l l < b r / > ├ ─ ─ M i c r o s o f t . V i s u a l B a s i c . d l l < b r / > ├ ─ ─ M i c r o s o f t . W i n 3 2 . P r i m i t i v e s . d l l < b r / > ├ ─ ─ M i c r o s o f t . W i n 3 2 . R e g i s t r y . d l l < b r / > ├ ─ ─ m s c o r l i b . d l l < b r / > ├ ─ ─ M y A p p < b r / > ├ ─ ─ M y A p p . d e p s . j s o n < b r / > ├ ─ ─ M y A p p . d l l < b r / > ├ ─ ─ M y A p p . p d b < b r / > ├ ─ ─ M y A p p . r u n t i m e c o n f i g . j s o n < b r / > ├ ─ ─ n e t s t a n d a r d . d l l < b r / > ├ ─ ─ p u b l i s h < b r / > │ ├ ─ ─ M y A p p < b r / > │ └ ─ ─ M y A p p . p d b < b r / > ├ ─ ─ S y s t e m . A p p C o n t e x t . d l l < b r / > ├ ─ ─ S y s t e m . B u f f e r s . d l l < b r / > ├ ─ ─ S y s t e m . C o l l e c t i o n s . C o n c u r r e n t . d l l < b r / > ├ ─ ─ S y s t e m . C o l l e c t i o n s . d l l < b r / > ├ ─ ─ S y s t e m . C o l l e c t i o n s . I m m u t a b l e . d l l < b r / > ├ ─ ─ S y s t e m . C o l l e c t i o n s . N o n G e n e r i c . d l l < b r / > ├ ─ ─ S y s t e m . C o l l e c t i o n s . S p e c i a l i z e d . d l l < b r / > ├ ─ ─ S y s t e m . C o m p o n e n t M o d e l . A n n o t a t i o n s . d l l < b r / > ├ ─ ─ S y s t e m . C o m p o n e n t M o d e l . D a t a A n n o t a t i o n s . d l l < b r / > ├ ─ ─ S y s t e m . C o m p o n e n t M o d e l . d l l < b r / > ├ ─ ─ S y s t e m . C o m p o n e n t M o d e l . E v e n t B a s e d A s y n c . d l l < b r / > ├ ─ ─ S y s t e m . C o m p o n e n t M o d e l . P r i m i t i v e s . d l l < b r / > ├ ─ ─ S y s t e m . C o m p o n e n t M o d e l . T y p e C o n v e r t e r . d l l < b r / > ├ ─ ─ S y s t e m . C o n f i g u r a t i o n . d l l < b r / > ├ ─ ─ S y s t e m . C o n s o l e . d l l < b r / > ├ ─ ─ S y s t e m . C o r e . d l l < b r / > ├ ─ ─ S y s t e m . D a t a . C o m m o n . d l l < b r / > ├ ─ ─ S y s t e m . D a t a . D a t a S e t E x t e n s i o n s . d l l < b r / > ├ ─ ─ S y s t e m . D a t a . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . C o n t r a c t s . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . D e b u g . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . D i a g n o s t i c S o u r c e . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . F i l e V e r s i o n I n f o . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . P r o c e s s . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . S t a c k T r a c e . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . T e x t W r i t e r T r a c e L i s t e n e r . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . T o o l s . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . T r a c e S o u r c e . d l l < b r / > ├ ─ ─ S y s t e m . D i a g n o s t i c s . T r a c i n g . d l l < b r / > ├ ─ ─ S y s t e m . d l l < b r / > ├ ─ ─ S y s t e m . D r a w i n g . d l l < b r / > ├ ─ ─ S y s t e m . D r a w i n g . P r i m i t i v e s . d l l < b r / > ├ ─ ─ S y s t e m . Dynamic.Runtime.dll
├── System.Formats.Asn1.dll
├── System.Formats.Tar.dll
├── System.Globalization.Calendars.dll
├── System.Globalization.dll
├── System.Globalization.Extensions.dll
├── System.IO.Compression.Brotli.dll
├── System.IO.Compression.dll
├── System.IO.Compression.FileSystem.dll
├── System.IO.Compression.ZipFile.dll
├── System.IO.dll
├── System.IO.FileSystem.AccessControl.dll
├── System.IO.FileSystem.dll
├── System.IO.FileSystem.DriveInfo.dll
├── System.IO.FileSystem.Primitives.dll
├── System.IO.FileSystem.Watcher.dll
├── System.IO.IsolatedStorage.dll
├── System.IO.MemoryMappedFiles.dll
├── System.IO.Pipes.AccessControl.dll
├── System.IO.Pipes.dll
├── System.IO.UnmanagedMemoryStream.dll
├── System.Linq.dll
├── System.Linq.Expressions.dll
├── System.Linq.Parallel.dll
├── System.Linq.Queryable.dll
├── System.Memory.dll
├── System.Net.dll
├── System.Net.Http.dll
├── System.Net.Http.Json.dll
├── System.Net.HttpListener.dll
├── System.Net.Mail.dll
├── System.Net.NameResolution.dll
├── System.Net.NetworkInformation.dll
├── System.Net.Ping.dll
├── System.Net.Primitives.dll
├── System.Net.Quic.dll
├── System.Net.Requests.dll
├── System.Net.Security.dll
├── System.Net.ServicePoint.dll
├── System.Net.Sockets.dll
├── System.Net.WebClient.dll
├── System.Net.WebHeaderCollection.dll
├── System.Net.WebProxy.dll
├── System.Net.WebSockets.Client.dll
├── System.Net.WebSockets.dll
├── System.Numerics.dll
├── System.Numerics.Vectors.dll
├── System.ObjectModel.dll
├── System.Private.CoreLib.dll
├── System.Private.DataContractSerialization.dll
├── System.Private.Uri.dll
├── System.Private.Xml.dll
├── System.Private.Xml.Linq.dll
├── System.Reflection.DispatchProxy.dll
├── System.Reflection.dll
├── System.Reflection.Emit.dll
├── System.Reflection.Emit.ILGeneration.dll
├── System.Reflection.Emit.Lightweight.dll
├── System.Reflection.Extensions.dll
├── System.Reflection.Metadata.dll
├── System.Reflection.Primitives.dll
├── System.Reflection.TypeExtensions.dll
├── System.Resources.Reader.dll
├── System.Resources.ResourceManager.dll
├── System.Resources.Writer.dll
├── System.Runtime.CompilerServices.Unsafe.dll
├── System.Runtime.CompilerServices.VisualC.dll
├── System.Runtime.dll
├── System.Runtime.Extensions.dll
├── System.Runtime.Handles.dll
├── System.Runtime.InteropServices.dll
├── System.Runtime.InteropServices.JavaScript.dll
├── System.Runtime.InteropServices.RuntimeInformation.dll
├── System.Runtime.Intrinsics.dll
├── System.Runtime.Loader.dll
├── System.Runtime.Numerics.dll
├── System.Runtime.Serialization.dll
├── System.Runtime.Serialization.Formatters.dll
├── System.Runtime.Serialization.Json.dll
├── System.Runtime.Serialization.Primitives.dll
├── System.Runtime.Serialization.Xml.dll
├── System.Security.AccessControl.dll
├── System.Security.Claims.dll
├── System.Security.Cryptography.Algorithms.dll
├── System.Security.Cryptography.Cng.dll
├── System.Security.Cryptography.Csp.dll
├── System.Security.Cryptography.dll
├── System.Security.Cryptography.Encoding.dll
├── System.Security.Cryptography.OpenSsl.dll
├── System.Security.Cryptography.Primitives.dll
├── System.Security.Cryptography.X509Certificates.dll
├── System.Security.dll
├── System.Security.Principal.dll
├── System.Security.Principal.Windows.dll
├── System.Security.SecureString.dll
├── System.ServiceModel.Web.dll
├── System.ServiceProcess.dll
├── System.Text.Encoding.CodePages.dll
├── System.Text.Encoding.dll
├── System.Text.Encoding.Extensions.dll
├── System.Text.Encodings.Web.dll
├── System.Text.Json.dll
├── System.Text.RegularExpressions.dll
├── System.Threading.Channels.dll
├── System.Threading.dll
├── System.Threading.Overlapped.dll
├── System.Threading.Tasks.Dataflow.dll
├── System.Threading.Tasks.dll
├── System.Threading.Tasks.Extensions.dll
├── System.Threading.Tasks.Parallel.dll
├── System.Threading.Thread.dll
├── System.Threading.ThreadPool.dll
├── System.Threading.Timer.dll
├── System.Transactions.dll
├── System.Transactions.Local.dll
├── System.ValueTuple.dll
├── System.Web.dll
├── System.Web.HttpUtility.dll
├── System.Windows.dll
├── System.Xml.dll
├── System.Xml.Linq.dll
├── System.Xml.ReaderWriter.dll
├── System.Xml.Serialization.dll
├── System.Xml.XDocument.dll
├── System.Xml.XmlDocument.dll
├── System.Xml.XmlSerializer.dll
├── System.Xml.XPath.dll
├── System.Xml.XPath.XDocument.dll
└── WindowsBase.dll


Подробнее здесь: https://stackoverflow.com/questions/791 ... executable
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»