Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Single file application .NET Core 6.0 fails to generate bundles, if the file is too large

The idea is to have an application with a single file executable, despite the size, can be a very big file.

I'm using the "Single file deployment and executable" of .NET 6.0 with the following command:

publish {csproj.FullName} -c Release -r win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained true -p:IncludeAllContentForSelfExtract=true -p:EnableCompressionInSingleFile=true

But when files are too big like greater then 4GB, I am not able to publish because of the following error:

C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(898,5): error MSB4018: System.ArgumentException: Stream length minus starting position is too large to hold a PEImage. (Parameter 'peStream') 
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(898,5): error MSB4018:    at System.Reflection.Internal.StreamExtensions.GetAndValidateSize(Stream stream, Int32 size, String streamParameterName) 
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(898,5): error MSB4018:    at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size) 

Any Idea how to fix it? Or another alternative to apply this idea.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

After some research there is a limitation on C# that doesn't allow for a single file to be more than 4gb.

So the alternative that I've chosen is to use self-extracting zips.

The one that I've chosen is 7Zip. Using their SDK I am able to zip my files into a single file, and then create a self-extracting zip that has the .exe for the file execution and it works as expected!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!