无法在VS2010 build devenv myProject.sln /build "DeBug" /useenv 上包含环境变量



为了在VS2010项目构建中包含环境变量,我在VS2010命令提示符

中运行。
devenv myProject.sln /build "DeBug" /useenv

并获取错误

Invalid Command Line. Unknown Switch : useenv

我看不到我出错的地方。

导航到安装视觉工作室的路径。在我当地的是:C: Program Files(X86) Microsoft Visual Studio 10.0

转到Common7 IDE目录:C: Program Files(X86) Microsoft Visual Studio 10.0 Common7 IDE和打开控制台。

现在,在commnad提示中运行以下命令:devenv -h

它将列出devenv.exe的所有可用参数和开关。在输出的底部,应该有以下内容:

特定于产品的开关:

/debugexe Open the specified executable to be debugged. The
    remainder of the command line is passed to this
            executable as its arguments.
/useenv Use PATH, INCLUDE, LIBPATH, and LIB environment variables
            instead of IDE paths for VC++ builds.

我假设您将获得较短的列表,而没有/useenv选项,类似于:

特定于产品的开关:

/debugexe       Open the specified executable to be debugged. The
    remainder of the command line is passed to this
            executable as its arguments.

这就是为什么您始终获得"无效命令行。未知开关:useenv"错误消息的原因。

我遇到了相同的问题,并进行了以下操作以修复它:

  1. 如果已安装了.NET Framework 4.5,请卸载它。
  2. 卸载Visual Studio 2010
  3. 安装.NET Framework 4.0再次安装Visual Studio 2010(请勿安装.NET 4.5)
  4. 安装Visaul Studio2010。
  5. 现在您可以安装.NET 4.5

我没有足够的时间进行调查和解释"为什么"。但是这些步骤解决了这个问题。

相关内容

最新更新