有没有办法在 C# 代码中修改 Visual Studio 2008 或 2010 项目预构建事件?
有没有办法在 C# 代码中修改 Visual Studio 2008 或 2010 项目预构建事件? C# 是否具有这样的预处理器指令,允许人们在项目编译和构建之前配置要运行的内容?
这样做的目的是扫描项目中的着色器效果文件 (.fx) 并重新编译它们,而无需在每次添加新的着色器效果文件时手动编辑预构建事件。如果您知道任何有利于这种情况的信息,我们非常欢迎您做出贡献。
Is there a way to modify Visual Studio 2008 or 2010 project pre-build events from within your code in C#? Does C# have such preprocessor directives that would allow one to configure what gets run before project compilation and build?
The purpose of this is to scan the project for shader effect files (.fx) and recompile them without editing the pre-build events manually each time I add a new shader effect file. If you know anything that would favor this scenario, you're more than welcomed to contribute.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有办法让构建过程执行它正在构建的代码(想一想......)。
但是,您可以使用 DynamicExecute 来自 MSBuild 扩展包,以在 MSBuild 文件中包含将在生成期间执行的 C# 代码。这适用于 VS2008 和 VS2010。
There is not a way to have the build process execute the code it's building (think about it for a minute...).
However, you can use DynamicExecute from the MSBuild Extension Pack to include C# code in your MSBuild file that will be executed during the build. This works in both VS2008 and VS2010.