在 Visual Studio 中指定项目属性值 [英] Specifying project Property values from within Visual Studio

查看:56
本文介绍了在 Visual Studio 中指定项目属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的项目文件中定义了这样的属性

If I have properties defined in my project file like so

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <foo>bar</foo>
    </PropertyGroup>
</Project>

我可以使用 /p:foo=newValue 在 MSBuild 命令行上轻松设置这些属性.

I can easily set these properties on the MSBuild command line using /p:foo=newValue.

是否可以在 Visual Studio (2010) GUI 中指定属性值?我查看过,但在项目属性页面中找不到任何内容.

Is there a way of specifying the property value within the Visual studio (2010) GUI? I have had a look but could not find anything within the project properties pages.

推荐答案

您在寻找条件编译符号吗?

Are you looking for conditional compilation symbols?

在 VS2010 中:

In VS2010:

  1. 转到项目属性
  2. 转到构建"选项卡
  3. 在 General 下,您将看到一个用于定义条件编译符号"的位置.

你可以在那里输入foo=bar",你会在你的 .csproj 文件中得到它:

You can enter "foo=bar" there, and you will get this in your .csproj file:

<Project ...>
  <PropertyGroup ...>
    <DefineConstants>Foo=bar</DefineConstants>
  </PropertyGroup>
</Project>

这篇关于在 Visual Studio 中指定项目属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆