[英]How can I compile a C# visual studio project without the default DLL file?
I'll just cut straight to the point.我直接切入正题。
I am making a compiler in C#, and creating it using visual studio.我正在 C# 中制作编译器,并使用 Visual Studio 创建它。 When I build my compiler to an executable, it also builds a "runtime" dll, how can I force visual studio to only build the executable without the dll?
当我将编译器构建为可执行文件时,它还会构建“运行时”dll,如何强制 Visual Studio 仅构建没有 dll 的可执行文件? (this is a .net core project)
(这是一个.net核心项目)
hypec.csproj hypec.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
solution解决方案
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hype", "hype.csproj", "{4653DC57-ACFF-419D-A57C-CEF0B5ECA174}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4653DC57-ACFF-419D-A57C-CEF0B5ECA174}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4653DC57-ACFF-419D-A57C-CEF0B5ECA174}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4653DC57-ACFF-419D-A57C-CEF0B5ECA174}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4653DC57-ACFF-419D-A57C-CEF0B5ECA174}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8D8BF52E-5BB5-4F40-8365-9A6C3EBD042E}
EndGlobalSection
EndGlobal
From the reference here: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0从这里的参考: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0
To publish a single-file executable, set the PublishSingleFile in your project or on the command line with the dotnet publish command:要发布单文件可执行文件,请在项目中或使用 dotnet publish 命令在命令行中设置 PublishSingleFile:
<PropertyGroup>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
OR或者
dotnet publish -r win10-x64 -p:PublishSingleFile=true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.