[英]How to create a new executable C# project with Visual Studio Code
I want to create a new executable project with Visual Studio Code + omnisharp.我想用 Visual Studio Code + omnisharp 创建一个新的可执行项目。 It works for dll but not for an exe file.
它适用于 dll 但不适用于 exe 文件。
Code:代码:
dotnet new console (pressed yes in popup)
dotnet restore
dotnet run
//hello world was visible in terminal (what means it works)
dotnet build
Build was successful but a dll file was created.构建成功,但创建了 dll 文件。
BTW: I used this for help -> https://github.com/dotnet/docs/blob/master/docs/core/tutorials/with-visual-studio-code.md顺便说一句:我用它来寻求帮助-> https://github.com/dotnet/docs/blob/master/docs/core/tutorials/with-visual-studio-code.md
You are using dotnet core, so executable files are still in .dll. 您使用的是dotnet core,因此可执行文件仍位于.dll中。 To run the file, run
dotnet nameofdll.dll
要运行该文件,请运行
dotnet nameofdll.dll
dotnet core
is cross-platform, and to reduce the tight coupling with windows, .exe
is not used for executables anymore. dotnet core
是跨平台的,为了减少与Windows的紧密耦合, .exe
不再用于可执行文件。
If you want your application to be Windows dependant, you will need to make your application target .Net Framework instead - you will get a .exe instead this way. 如果希望您的应用程序依赖Windows,则需要将应用程序的目标设置为.Net Framework,而您将通过这种方式获得一个.exe。
ok heres how i did it好的,我是怎么做到的
if you go into the folder where the app is and go to bin/debug/net6.0如果您将 go 放入应用程序所在的文件夹,并将 go 放入 bin/debug/net6.0
i found a exe file along with four other files i have no idea what they do我发现了一个 exe 文件以及其他四个文件,我不知道它们在做什么
and a file called publish, also try F1 and searching for publish that might make these files appear (publish seems to be the same 5 files outside of the publish file)和一个名为发布的文件,也尝试 F1 并搜索可能使这些文件出现的发布(发布似乎是发布文件之外的相同 5 个文件)
and to the people who downvoted my terrible joke to literal extinction以及那些将我的可怕笑话贬为真正灭绝的人
there, ya happy?在那里,你快乐吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.