Question

I'm searching for a one-click way to inspect preprocessed or assembly output. It's just tedious to open file properties, change the respective setting, compile, go to the obj directory and open the resulting file by hand.

Does anyone know of any Visual Studio add-in, macro or whatever to automate this task?

Était-ce utile?

La solution

EDIT: An extension for VS 11+ is available @ https://github.com/Trass3r/DevUtils

I solved it myself by creating a nice macro. It's way more sophisticated but basically works like this:

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)

Very useful in combination with AsmHighlighter.

Preprocessed file can be generated similarly with

tool.GeneratePreprocessedFile = preprocessOption.preprocessYes
' there's no separate option for this, so misuse /Fo
tool.ObjectFile = System.IO.Path.GetTempFileName + ".cpp"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top