Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include native libraries when publishing executable #97

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

greenhandatsjtu
Copy link
Contributor

@greenhandatsjtu greenhandatsjtu commented Jun 28, 2022

Fix: #96 #73 #44

set IncludeNativeLibrariesForSelfExtract to really publish a singe file without DLLs:
image

ref: https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md#user-experience
To publish single file executable without DLLs, we have to set IncludeNativeLibrariesForSelfExtract to true in RunCat.csproj PublishWithDotNetProdile.pubxml, otherwise we'll publish executable along with several DLLs:
image
This is why some users (me included) can't run v1.10 and v1.11: lack of some DLLs like clrcompression.dll

Detailed explanation can be found at this issue: #96

@greenhandatsjtu greenhandatsjtu changed the title fix: publish to single file fix: include native libraries when publishing executable Jun 28, 2022
somnisomni added a commit to somnisomni/RunCat-Windows that referenced this pull request Jun 28, 2022
@greenhandatsjtu
Copy link
Contributor Author

greenhandatsjtu commented Jun 28, 2022

Sorry I'm not familiar with publishing of .NET, am I supposed to modify PublishWithDotNetProdile.pubxml instead of RunCat.csproj?
I reverted my changes in RunCat.csproj then ran:

dotnet publish -p:PublishProfile=PublishWithDotNetProdile.pubxml

it porduced executable along with several DLLs. Then I added IncludeNativeLibrariesForSelfExtract to PublishWithDotNetProdile.pubxml, now it only produce an executable and a .pdb file.

@greenhandatsjtu
Copy link
Contributor Author

I think modifying PublishWithDotNetProdile.pubxml is the right choice, fixed and pushed.

@somnisomni
Copy link
Contributor

Sorry I'm not familiar with publishing of .NET, am I supposed to modify PublishWithDotNetProdile.pubxml instead of RunCat.csproj? I reverted my changes in RunCat.csproj then ran:

dotnet publish -p:PublishProfile=PublishWithDotNetProdile.pubxml

it porduced executable along with several DLLs. Then I added IncludeNativeLibrariesForSelfExtract to PublishWithDotNetProdile.pubxml, now it only produce an executable and a .pdb file.

To be specific, yes, but I think it really doesn't matter where the option to be included. Framework-dependent builds will not change its behaviors whether the option is on or not.

@greenhandatsjtu
Copy link
Contributor Author

It does change its behavior for me though.
This is what I got without IncludeNativeLibrariesForSelfExtract in PublishWithDotNetProdile.pubxml:
image

And this is what I got with IncludeNativeLibrariesForSelfExtract:
image

I think maybe it's because you use .NET 6.

@somnisomni
Copy link
Contributor

somnisomni commented Jun 28, 2022

Oh, I mean IncludeNativeLibrariesForSelfExtract could be included in either csproj or pubxml. both also working on .NET 6.

@greenhandatsjtu
Copy link
Contributor Author

Oh, I mean IncludeNativeLibrariesForSelfExtract could go either csproj or pubxml. both also working on .NET 6.

Sorry I misunderstood your reply :(
Then I think it'll be fine to adopt this patch even this project will support .NET 6 in the future :) Thank you!

somnisomni added a commit to somnisomni/RunCat-Windows that referenced this pull request Jun 28, 2022
@Kyome22 Kyome22 mentioned this pull request Jul 4, 2022
@Kyome22 Kyome22 merged commit 403d623 into Kyome22:master Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I found the reason why both v1.11 and v1.10 don't work
3 participants