【问题标题】:How to get $IntDir in C#如何在 C# 中获取 $IntDir
【发布时间】:2014-01-03 23:04:01
【问题描述】:

我知道 $(BaseIntermediateOutputPath),但我需要完整的路径。

出于某种原因,Microsoft 决定对 AnyCPU 使用“$(BaseIntermediateOutputPath)$(ConfigurationName)\”,而对 x64 使用“$(BaseIntermediateOutputPath)$(PlatformName)\$(ConfigurationName)\”。

我有一个命令需要访问中间输出路径中的 .resource 文件。但是,由于一个平台需要 $(PlatformName) 而另一个不需要,我不能只使用一个命令。我目前的解决方案是使用条件(Condition="'$(Platform)' !='AnyCPU'")。如果我可以访问完整的中间目录,就像 C++ 中的 $(IntDir) 一样,它会更干净。

我确定下一个问题是为什么我不只使用 AnyCPU。我有一个托管 C++ 项目作为我的解决方案的一部分,如果我敢从 AnyCPU 项目中引用 x64 项目,我会收到可怕的警告。那么为什么我不只使用 x86 而不是使用 AnyCPU 呢?因为 IDE 是 32 位的,并且设计器无法处理 x64 项目。不仅如此,而且不仅仅是告诉你,你会在设计器中得到神秘的错误消息和堆栈跟踪,你必须在这里搜索它的含义。

【问题讨论】:

  • 只使用$(IntermediateOutputPath) 是否有效?

标签: c# .net visual-studio-2012 msbuild csproj


【解决方案1】:

$(IntermediateOutputPath).

查看 c:\Program Files(x86)\MsBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets。

第 33 行:<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'==''">$(IntDir)</IntermediateOutputPath>

尝试以下方法之一:

  1. $(IntermediateOutputPath)
  2. $(IntDir)

【讨论】:

  • $(IntDir) 为空。我会在星期一尝试 $(IntermediateOutputPath)。
  • 我已经尝试过 $(IntDir),但是 $(IntermediateOutputPath) 是赢家,谢谢!
猜你喜欢
  • 2021-07-18
  • 2010-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-31
相关资源
最近更新 更多