我正在搜索一键式检查预处理或汇编输出。 打开文件属性,更改相应设置,编译,转到obj目录并手动打开生成的文件,这简直太乏味了。
有没有人知道任何Visual Studio加载项,宏或其他什么来自动执行此任务?
答案 0 :(得分:0)
编辑:@ https://github.com/Trass3r/DevUtils
可以获得VS 11+的扩展程序我通过创建一个漂亮的宏来解决它。 它更复杂,但基本上是这样的:
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Dim doc As EnvDTE.Document = DTE.ActiveDocument
Dim prj As VCProject = doc.ProjectItem.ContainingProject.Object
Dim file As VCFile = prj.Files.Item(doc.Name)
Dim fileconfigs As IVCCollection = file.FileConfigurations
Dim fileconfig As VCFileConfiguration = fileconfigs.Item("Release|x64")
Dim tool As VCCLCompilerTool = fileconfig.Tool
Dim asmFile = System.IO.Path.GetTempFileName + ".asm"
tool.WholeProgramOptimization = False
tool.AssemblerOutput = asmListingOption.asmListingAsmSrc
tool.AssemblerListingLocation = asmFile
fileconfig.Compile(True, True)
Dim window = DTE.ItemOperations.OpenFile(asmFile, Constants.vsViewKindCode)
与AsmHighlighter结合使用非常有用。
可以使用
类似地生成预处理文件tool.GeneratePreprocessedFile = preprocessOption.preprocessYes
' there's no separate option for this, so misuse /Fo
tool.ObjectFile = System.IO.Path.GetTempFileName + ".cpp"