473,699 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VC++.net, C# - How to set executable name from code

1 New Member
Hello all
Does anybody know how to set the output file (*.exe) name from with within the source code? I have an application that I would like to compile into two different executables. It is basically a client/server application, built with VC++.net Express edition, and the code for the client and server are so similar that I am using a single project and a #define statement to switch between the client and server outputs. And yes, they do need to be different executables.
I have attempted to do this by setting the (/OUT:[file]) linker option as shown below. I get a LNK4070 error when attempting to compile this and get the message "EXP differs from output filename".

#define CLIENT

#if defined( CLIENT )
#pragma comment(linker, "/OUT:\"C:\\Proje cts\\MyProject\ \Client.exe\"")
#elif defined( SERVER )
#pragma comment(linker, "/OUT:\"C:\\Proje cts\\MyProject\ \Server.exe\"")
#endif

The documentation for the /OUT linker option says that it should overwrite the output file name set in the project properties but this doesn't seem to be the case.

Or perhaps I am taking the wrong approach here. Does anybody knwo if there is a .NET method of changing the output executable name from within the code? If you know how this is achvieved in C# or VB.net please let me know and I will convert it to VC++.net.

Daniel
Nov 23 '07 #1
0 1024

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4848
by: Scott Chang | last post by:
Hi all, I loaded the following program 'HelloMCPP' to my MS VC++ .NET (2002) that is installed on my Windows XP Professional PC: ------------------------------------- AssemblyInfo.cpp --------------------- #include "stdafx.h" using namespace System::Reflection; using namespace System::Runtime::CompilerServices;
4
2200
by: RajW | last post by:
Is it possible to make VC.NET 2003 produce an MS DOS (no Windows) executable? If so how? I was able to get it to produce an MS DOS executable, but when I copied the file to a plain DOS (legacy) system it said that it would not run. Thanks, /*Raj*/
5
2924
by: Scott Chang | last post by:
Hi all, I copied a set of VC++ version 6 source code of the 'cppdll'(2 projects) from a website and put the cppdll.cpp, cppdll.def, cpp.h, (as the 1st project) and test.cpp (as the 2nd project) into my Microsoft VC++ .NET 2002 - Windows XP Pro PC: //----cppdll.cpp---- #include "cppdll.h" //prevent function name from being mangled
0
1041
by: Peter Steele | last post by:
We have a build script that uses any to compile our .NET VC++ projects. A typical target looks like this: <target name="MyProj"> <exec executable="devenv"> <arg line= "MyProj.vcproj /build release /project MyProj"/> </exec > </target> This builds the project fine but no output is generated. I tried to add an
4
1899
by: Alex | last post by:
Hi there I'm switching from VC++ 6.0 to VC++ .NET 2003. Since there is no stand-alone version of VC++ .NET 2003 Pro, I went and purchased the Standard version, which does not have an optimizing compiler. I have been made aware of the existence of the VC++ Toolkit 2003: http://msdn.microsoft.com/visualc/vctoolkit2003/
2
1296
by: DavideR | last post by:
How to launch a exe in a vc++ 2002 program? What is the equivalent of vb6's app.path? How can i get the exe name? Thanks davide
1
1736
by: Eric | last post by:
I have 2 projects in a VC 6.0 workspace. One is a C++ static library. The other is an executable that is dependent on the static lib. In the Linker options for the executable, I have included the library name into Object/library modules. In addition, I have given the executable project a dependency on the static lib. However, when I modify the static lib and batch build the projects, the executable will not relink! Is there something...
16
6721
by: John | last post by:
Does the length of my C variable names have any affect, performance-wise, on my final executable program? I mean, once compiled, etc., is there any difference between these two: number = 3; n = 3; I know its setting aside storage for the variable itself; does it also use up more storage if the variable name is longer? I realize it would probably take quite a lot of long variable names to make any impact if so, but I was just curious...
0
1364
by: ppuniversal | last post by:
I am making a client server application in VC++ 2005. It compiles correctly with 0 errors. But when I execute the executable file say GridServer.exe, it gives the following error : The application has failed to start beacuse MSVCP80D.dll was not found. Reinstalling the application may fix this problem. Then I searched this file in the C:\Program Files\Visual Studio.... folder and got a file with this name. So I copied this file to...
0
9174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9034
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7750
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.