How To Compile All Assemblies into One Folder?

M

Mario T. Lanza

I am working with Visual Studio. The solution I am developing is
composed of about 8 separate projects. Some of these projects
represent different tiers in the N-tiered architecture (data, business
logic, presentation, etc.). Right now, some of the projects are
inter-related and reference each other using Project References. When
I select "Rebuild Solution" to compile, each project is successfully
compiled into its own directory (and each project has its own
directory). Because I use Project References, copies of the
referenced assemblies are copied into each directory whose project
makes use of them. In this way, one commonly used assembly might be
copied into 4 or 5 other folders. This results in a lot of redundancy
that I hope to avoid.

I would like to compile everything into one single directory.
Presently, I compile everything using "Rebuild Solution" and then copy
all of the assemblies and executables into one folder. I would like
to avoid this step and compile everything into one folder from which I
can run my application.

Using the solution explorer, I have right-clicked on the projects,
chosen "Properties" and located the "Configuration Properties" and
selected the "Build" tab. It has a property called "Output Path"
which would seem to allow me to do exactly what I want to do; however,
there's a catch. After pointing all my projects to one folder I
attempt a "Rebuild Solution". Inevitably the compile fails with error
messages of this nature:

"The file 'MyAssembly.dll' cannot be copied to the run directory. The
process cannot access the file because it is being used by another
process."

and

"Could not copy temporary files to output directory."

and

"Cannot copy assembly 'AssemblyName' to file 'C:\...\MyAssembly.dll'.
The process cannot access the file because it is being used by another
process."

It seems by pointing all of the projects to one output path that the
compiler keeps butting heads with itself. This is annoying. Doesn't
it make sense that I should be able to compile a more complicated
program (broken down into parts) all into one working directory?

Any help would be appreciated. I have been working around this issue
for the last year and a half!

Mario T. Lanza
Clarity Information Architecture, Inc.
 
R

Richard Grimes [MVP]

To be honest I don't know how to solve this. The alternative is to use a
make file. Visual Studio is still delivered with nmake and it is simple to
create a makefile. Using a makefile still means that you can use the IDE to
write code and use the IDE debugger (to use the debugger, use the File->Open
Solution, change Files of Type to Executable Files and load the EXE that you
built with debug info /debug)

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top