views:

125

answers:

4

I have project X, fully operational that compiles into X.exe
I have project Y, it has a reference to project X, and compiles to: Y.exe; Y.dll

I build project X's solution and the release folder has: X.exe
I build project Y's solution and the release folder has: X.exe, Y.exe, Y.dll

How do I remove the extra X.exe in project Y?

+4  A: 

Even though it's technically possible, it's not common practice to reference an exe... you usually reference a DLL What I would do is extract the common parts into a class library project, and reference the resulting DLL in both executables

Thomas Levesque
I was thinking of doing that but I was hoping for another easy way
Fredou
currently doing that... next time I wont do this mistake again :-)
Fredou
+1  A: 

You have the "extra" exe (I'm assuming you mean the compiled output of project X) in project Y's output directory because you have added a reference to it in the project. If you do not need a reference to it, remove the reference and it will not appear in the output directory. If you do need a reference to it, you will need the exe present otherwise your Y.exe will not run correctly.

adrianbanks
A: 

Bring up the properties for the reference to the exe and set copy-local to false.

Joel Lucsy
problem is I need the X.exe to run Y.exe
Fredou
Then you've contradicted yourself. Either you need it or you don't. Perhaps you should be placing all your outputs into a single directory instead of multiple.
Joel Lucsy
A: 

Simple answer: you can't, since you are using X.exe assembly in Y.

Using ILMerge might help (to merge X.exe into Y.exe)

Proper answer: you have to refactor to split X functionality into a reusable class project and an executables that use it.

You can't. You are referencing

Rinat Abdullin