问题描述
现在我正在考虑写路径的预生成事件的文件,然后从代码中的文件阅读,但我不知道是否有一个更简单更优雅的方式。
Right now I'm thinking write the paths to a file in the pre-build event and then read from that file in the code, but I'm wondering if there's an easier more elegant way.
编辑:这是形式的后续的,因为我并没有真正得到一个答案,看是否我能得到一个答案,一个简单的问题。
edit: This is sort of a follow up to Help with one step build all projects + installer (.NET + WiX) since I didn't really get an answer to that, seeing if I can get an answer to a simpler question.
推荐答案
下面是一个肮脏的黑客:他们转储到文件
Here's a dirty hack: dump them to a file.
添加一个动作到预先生成事件输出解决方案的文件路径:
Add an action to the pre-build events to output your solution's path to a file:
回声$(SolutionDir)> SolutionDirFile.txt
读取文件 SolutionDirFile.txt
在你的C#代码。
Read the file SolutionDirFile.txt
in your C# code.
这篇关于什么是简单的方法来从代码中访问C#预生成宏,例如$(SolutionDir)和$(DevEnvDir)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!