Question about VS extensibility and C#
Date: 06/09/05
(C Sharp) Keywords: html, asp, microsoft
I've been trying for a while to access the linker object's mapfile setting for a project in Visual Studio .NET via the extensibility model. I'm writing in C#.
Microsoft has this to say about it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcext/html/vxlrfvcprojectenginelibraryvclinkertoolmapfilename.asp
The example code they provide is for VB .NET, and goes something like this:
--------------
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Public Module Module1
Sub Test()
Dim prj As VCProject
Dim cfgs, tools As IVCCollection
Dim cfg As VCConfiguration
Dim tool As VCLinkerTool
prj = DTE.Solution.Projects.Item(1).Object
cfgs = prj.Configurations
cfg = cfgs.Item(1)
tool = cfg.Tools("VCLinkerTool")
tool.GenerateMapFile = True
tool.MapFileName = "my.map"
End Sub
End Module
--------------
I tried to adapt some of this to C#, but the compiler can't find the Microsoft.VisualStudio namespace, and it doesn't show up in the auto-complete list. Of course, none of the data types are recognized either (VCProject, IVCCollection, etc.). All other documentation I've seen leads me to this problem. Does anyone know of another way to access a project's active mapfile setting?
Source: http://www.livejournal.com/community/csharp/31119.html