C#等价于#If TARGET =" winexe"

编程入门 行业动态 更新时间:2024-10-24 01:57:03
本文介绍了C#等价于#If TARGET =" winexe"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Visual Basic中,要确定构建配置(子系统),您可以:

In Visual Basic, to determine the build config (subsystem) you can go:

#If TARGET = "winexe" Then ' Insert code to be compiled for a Windows application. #ElseIf TARGET = "exe" Then ' Insert code to be compiled for a console application. #End If

C#中的等价物是什么? 谢谢!

What is the equivalent in C#? Thanks!

推荐答案

我发现了一些静态解决方案,但是考虑到这个悲惨的目标,它还有一些开发时间,我还没准备好投入。我可以解释这个想法。 要理解它,请查看项目文件。它具有XML节点 OutputFile 。例如,它可能是 I found some static solution, but it would some development time, which I'm not ready to dedicate, taking into account the miserable goal. I can explain the idea. To understand it, look at the project file. It has the XML node OutputFile. For example, it could be <OutputType>WinExe</OutputType>

or

<OutputType>Exe</OutputType>

现在,基于XML的MSBuild项目文件语言具有 Condition 属性等功能。你会看到类似

Now, the XML-based MSBuild project file language has such a feature as Condition attribute. You will see something like

<PropertyGroup Condition=" '

(配置)|

(平台)'=='调试| AnyCPU' > (Platform)' == 'Debug|AnyCPU' ">

你可以写 条件属性。你会看到类似

and you can write Condition attribute. You will see something like

<PropertyGroup Condition=" '

更多推荐

C#等价于#If TARGET =&quot; winexe&quot;

本文发布于:2023-11-09 15:40:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572759.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:amp   TARGET   winexe   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!