Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / April 2007

Tip: Looking for answers? Try searching our database.

Custom OutputFile using VC2005

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ebs2002@gmail.com - 17 Apr 2007 00:27 GMT
My current project involves building a lot of executable files, each
with custom settings in a header that uses the project configuration:

#ifdef _FOO1
 #define bar foobaz
 #define foo foobar
#endif

_FOO1 is defined via the project configuration.

Within this, I would like to add a #define OUTPUT_FILE "FOO1.exe", and
then programmatically set the linker's /OUT flag to OUTPUT_FILE.

MSDN directs me to import VCProjectEngine.dll, which has an
OutputFile.set() function, but I cannot find any example of this for
VC anywhere (the example they provide is in VB, which I am not fluent
in, and have not been able to translate to VC).

Their example:
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.<b>OutputFile</b> = "$(ProjectName).x"
   End Sub
End Module

I have tried instantiating a VCProject object, a VCLinkerTool object,
a VCConfiguration object, etc, to no avail ("cannot instantiate
abstract class due to following members: 'HRESULT
IUnknown::QueryInterface(const IID &_void **)'  : is abstract")

Can anybody help me out?  There has to be a simple way to set the
OutputFile programmatically.

Thank you for your time,

~Shane
ebs2002@gmail.com - 17 Apr 2007 15:16 GMT
Last night, I had been working on this problem for a few hours and my
brain was a little fried.  I realize now the solution I was
investigating would be for setting the output file at run-time
(through instantiating a compiler and compiling a separate project, or
something along those lines).

My real question is, is there a way to programmatically set a flag pre-
compile that will change the /OUT flag the linker is using, ie through
a #pragma?  An alternate approach: is there a way I can
programmatically set a compiler variable pre-compile that my project
can reference?

ie: my project settings have /OUT:${OutputFile}, and in my code I have
#pragma EnvironmentVariable OutputFile "outfile.exe"

Thank you for your time,

~Shane

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.