更新时间:2021-08-16 01:52:00
您在VS2008比较一个C ++项目在VS2010 C#项目。这两个项目都使用不同的编译引擎。 VS2008 C ++项目使用化妆基础的建立和使用大量的环境变量。 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的可以使用环境vairables。但是,VS不提供用户界面来设置这些标准C#项目(即使安装了早期版本)。最大的可能是你正在寻找在构建项目旨在通过命令行中使用 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
.
您有两个选择:
<的PropertyGroup>
元素,你需要和你想要设置的值的特定变量。 (为的MSBuild般的环境变量做出的工作设置属性)的MSBuild /属性:其中;名称> =<价值> ...
<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) msbuild /property:<name>=<value> ...
(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.