1 out of 19 rated this helpful - Rate this topic

Two or more objects have the same target location '<location>' 

You are attempting to install two or more copies of the same file in the same folder. Only one copy can be installed; however, multiple copies can be placed in the same folder in the File System Editor provided that each has a unique condition.

To correct this error

  1. Double-click the error in the Task List to go to the file in the File System Editor.

  2. Delete the duplicate file, or select the Condition property in the Properties window for each copy of the file and enter a unique condition for each.

    NoteNote

    If the Package files property for the project is set to As loose uncompressed files this error will still occur. You can correct this by adding a Custom folder and setting its DefaultLocation property to the same value as the first folder, then moving the second copy of the file to the new folder.

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Why has nothing been done about this?
It should not be that hard to fix this. I've a dll that is listed only once in the project dependencies and is listed only once in the file System list. Yet I not only get this message upon rebuild, (as a warning NOT an error,) but upon the install the application can not find any instances of the dll. And to add to that the file is underlined in red and does not give any indication as to why. The solution spelled out by MN_S does not work. The solution spelled out by Microsoft does not work because there is no place the files are visibly shown twice. The packaging and deployment wizard in VB 6.0 was a thousand time better than this process. It would take minutes to build a package that always worked. I been working on this for 6 days and still can't get it to work.
Continuing Problem
My project consists of about 10 applications and an installer. Many of the applications share components (dlls). I have carefully set up all dependencies. When building the installer, whenever projects A and B both depend on component C, the warning in question is issued for C. Sometimes the Fix mentioned above (cleaning and refreshing and rebuilding) works, sometimes it does not. On top of that sometimes you can delete the duplicate but usually you cannot (the delete choice is dimmed). To me it seems like this is a bug in VS, and it has happened at least since VS2005. Why can't MS either correct this or at least provide the option to not include duplicates in this situation.
Fixing these warnings
This is how I got rid of these warning messages in my project:

  1. Right click on the Solution file, select "Clean"
  2. Then, on your install project, navigate down to the "Detected Dependencies" folder.. right click and select "Refresh Dependencies".. Since your solution is clean, all your dependencies will be cleared.
  3. Next, right click on your setup project and select "Rebuild"
Exe and Exe.config seen as same file
In my error list, the two files listed were [appname].exe and [appname].exe.config. These are NOT the same file. This appears to be an error on the part of the VS environment not to recognize these two files as distinct. Since it is only a Warning, and not an Error, I am choosing to ignore the problem for the time being. The application runs.
Not possible to delete or set - Primary Output from Project dependancies causing this
This explanation is not good enough.

It is not possible to delete or set Conditions to fix this error, as suggested above. When setup project is including several "Primary Output from ProjectX", the dependencies are causing this warning. And you cant delete dependencies or individual projects wont compile.

Search net for "Two or more objects have the same target location" and you will see the problem many are having with this "warning" - I have 72 of them in a setup project and I cant get rid of them. I including the required Primary Output from Project as the setup targets and VS2008 is causing the problem itself by adding duplicate dependencies. You cannot delete them to remove the warning and there is no pragma/warning number to just ignore it!

Please improve, thanks.
Advertisement