• <small id='FNNLj'></small><noframes id='FNNLj'>

  • <tfoot id='FNNLj'></tfoot>
    • <bdo id='FNNLj'></bdo><ul id='FNNLj'></ul>

        <i id='FNNLj'><tr id='FNNLj'><dt id='FNNLj'><q id='FNNLj'><span id='FNNLj'><b id='FNNLj'><form id='FNNLj'><ins id='FNNLj'></ins><ul id='FNNLj'></ul><sub id='FNNLj'></sub></form><legend id='FNNLj'></legend><bdo id='FNNLj'><pre id='FNNLj'><center id='FNNLj'></center></pre></bdo></b><th id='FNNLj'></th></span></q></dt></tr></i><div id='FNNLj'><tfoot id='FNNLj'></tfoot><dl id='FNNLj'><fieldset id='FNNLj'></fieldset></dl></div>

        <legend id='FNNLj'><style id='FNNLj'><dir id='FNNLj'><q id='FNNLj'></q></dir></style></legend>

        如何在 Visual Studio 2010 中设置环境变量?

        时间:2023-09-13

        <legend id='k4TX8'><style id='k4TX8'><dir id='k4TX8'><q id='k4TX8'></q></dir></style></legend>

        <small id='k4TX8'></small><noframes id='k4TX8'>

        <tfoot id='k4TX8'></tfoot>

            <i id='k4TX8'><tr id='k4TX8'><dt id='k4TX8'><q id='k4TX8'><span id='k4TX8'><b id='k4TX8'><form id='k4TX8'><ins id='k4TX8'></ins><ul id='k4TX8'></ul><sub id='k4TX8'></sub></form><legend id='k4TX8'></legend><bdo id='k4TX8'><pre id='k4TX8'><center id='k4TX8'></center></pre></bdo></b><th id='k4TX8'></th></span></q></dt></tr></i><div id='k4TX8'><tfoot id='k4TX8'></tfoot><dl id='k4TX8'><fieldset id='k4TX8'></fieldset></dl></div>

              <bdo id='k4TX8'></bdo><ul id='k4TX8'></ul>
                <tbody id='k4TX8'></tbody>
                  本文介绍了如何在 Visual Studio 2010 中设置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在 Visual Studio 2010 中设置环境变量?

                  How do I set Environment Variables in Visual Studio 2010?

                  我找到了这个网页.

                  上面写着:

                  从项目"菜单中,选择属性".

                  From the Project menu, choose Properties.

                  在左侧窗格中,选择配置属性,然后选择环境.

                  In the left pane, select Configuration Properties, and then select Environment.

                  但是当我选择配置属性"时,没有环境"选项:

                  But when I select "Configuration Properties", there is no "Enviroment" option:

                  这是 VS 2008 中的一个示例:

                  This is an example in VS 2008:

                  但是在 VS 2010 中是如何完成的呢?

                  But how is it done in VS 2010?

                  推荐答案

                  您将 VS2008 中的 C++ 项目与 VS2010 中的 C# 项目进行比较.这两个项目使用不同类型的构建引擎.VS2008 C++ 项目使用基于 make 的构建并大量使用环境变量.VS2010(以及 VS2008)C# 项目使用 MSBuild,很少 (1) 依赖于环境变量.

                  You are comparing a C++ project in VS2008 to a C# project in VS2010. These two projects use different kind of build engine. VS2008 C++ project use a make-based build and use heavily environment variables. VS2010 (and VS2008 for that matter) C# projects use MSBuild and rarely (1) depend on environment variables.

                  除非您修改了 .csproj 文件或拥有自定义构建工具,否则更改环境变量不应该是随心所欲的方式.如果您描述了您的目标,我们将能够更好地为您提供实现目标的建议.

                  Unless you have modified your .csproj file or have a custom build tool, changing environment variables should not be the way to do whatever you want to it is. If you describe your goal, we'll be able to better help you with advice how to achieve it.

                  更新:MSBuild 可以使用环境变量.但是,VS 不提供用于设置标准 C# 项目的 UI(即使您安装了早期版本).您正在查看的构建项目很可能旨在使用 msbuild.exe 从命令行构建.

                  Update: MSBuild can use environment vairables. However, VS does not provide an UI to set those for standard C# projects (even if you install earlier version). Most probably the build project you are looking at is intended to be build from the command line using msbuild.exe.

                  你有几个选择:

                  • 在记事本中打开 .csproj 文件,然后将所需的特定变量和要设置的值添加到 <PropertyGroup> 元素中.(在 MSBuild 的工作中设置的属性类似于 Make 的环境变量)
                  • 如果环境变量仅在构建前和构建后事件中使用,您可以在项目属性的构建事件选项卡中编辑这些变量.
                  • 如果您使用 msbuild.exe 从命令行构建,您可以在命令行上指定这些属性,如下所示:msbuild/property:<name>=<value>...
                  • 您可以创建一个包含所有属性的 .settings 文件,然后将其包含在需要共享相同值的所有 .csproj 文件中.
                  • 您可以打开一个新的命令提示符,在其中设置环境变量,然后从其中启动 VS.VS 将从该命令提示符获取环境.
                  • Open the .csproj file in Notepad and add to the <PropertyGroup> element the particular variable you need with the value you want to set. (properties set in a work for MSBuild like environment variables for Make)
                  • If the environment variables are used only in the pre-build and post-build events, you can edit those in the Project properties, in the Build Events tab.
                  • If you build from the command line using msbuild.exe, you can specify those properties on the command line, like this: msbuild /property:<name>=<value> ...
                  • You can create a .settings file, which contains a with all the properties and then include it in all the .csproj files that need to share same values.
                  • You can open a new command-prompt, set the environment variables in it and then launch VS from inside it. VS will pick up the environment from that command prompt.

                  (1) 我很想说从不",但我确实有几个项目希望构建依赖于环境变量,主要是为了在未安装 .Net 的机器上启用自动构建.

                  (1) I was tempted to say "never", but I do have couple of projects where I want the build to depend on environment variables, mostly to enable automated builds on machines without .Net installed.

                  这篇关于如何在 Visual Studio 2010 中设置环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以从 csharp 中的编译时环境变量中创建一个常量吗? 下一篇:PATH 变量的 GetEnvironmentVariable() 和 SetEnvironmentVariable()

                  相关文章

                  <small id='y8WT2'></small><noframes id='y8WT2'>

                    <tfoot id='y8WT2'></tfoot>
                  1. <legend id='y8WT2'><style id='y8WT2'><dir id='y8WT2'><q id='y8WT2'></q></dir></style></legend>

                        <bdo id='y8WT2'></bdo><ul id='y8WT2'></ul>

                      <i id='y8WT2'><tr id='y8WT2'><dt id='y8WT2'><q id='y8WT2'><span id='y8WT2'><b id='y8WT2'><form id='y8WT2'><ins id='y8WT2'></ins><ul id='y8WT2'></ul><sub id='y8WT2'></sub></form><legend id='y8WT2'></legend><bdo id='y8WT2'><pre id='y8WT2'><center id='y8WT2'></center></pre></bdo></b><th id='y8WT2'></th></span></q></dt></tr></i><div id='y8WT2'><tfoot id='y8WT2'></tfoot><dl id='y8WT2'><fieldset id='y8WT2'></fieldset></dl></div>