簡體   English   中英

編譯 C# 控制台而不需要 dll

[英]Compile C# console without dll needed

When I compile my C# Console it comes with an dll, if I remove the dll the application doesn't work, and I need it to work with only an.exe and no.dll files. https://prnt.sc/t1gu4m

  1. 右鍵單擊您的項目
  2. Select 發布
  3. 部署模式:自包含
  4. 檢查生成單個文件選項

瞧,你得到了一個具有所需依賴項的 exe

除了莫里斯樂高樂園的回答。 如果您使用的是 dotnet cli,請運行:

dotnet publish -p:PublishSingleFile=true --no-self-contained # Other arguments.

如果您希望您的可執行文件依賴於 .NET,則僅使用--no-self-contained標志,即,如果用戶沒有 .NET 的 CoreCLR,它就無法運行。 否則,只需將 PublishSingleFile 設置為 true。 您還可以使用清單/配置文件。 有關更多信息,請參閱

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM