什么是简单的方法来从代码中访问C#预生成宏,例如$(SolutionDir)和$(DevEnvDir)? [英] What's an easy way to access prebuild macros such as $(SolutionDir) and $(DevEnvDir) from code in C#?

查看:1497
本文介绍了什么是简单的方法来从代码中访问C#预生成宏,例如$(SolutionDir)和$(DevEnvDir)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在考虑写路径的预生成事件的文件,然后从代码中的文件阅读,但我不知道是否有一个更简单更优雅的方式。

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.

编辑:这是形式的后续的帮助足下构建所有项目+安装程序(.NET +维克斯),因为我并没有真正得到一个答案,看是否我能得到一个答案,一个简单的问题。

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.

添加一个动作到预先生成事件输出解决方案的文件路径:

  1. 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)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆