5

I have a solution with a couple of projects. Some(2) of these projects are setup projects. Whenever I open the solution I get errors like the following:

Error 16 Unable to find source file 'Z:...\Remotion.Data.Linq.dll' for assembly 'Remotion.Data.Linq.dll', located in '[TARGETDIR]' Z:...\CirrusNodeServiceSetup.vdproj CirrusNodeServiceSetup

These errors can be made to go away by either doing a build or by 'touching'(with my mouse) the dependencies folders in the setup projects.

Is there any way to make this weird behavior stop?

ouflak
  • 2,458
  • 10
  • 44
  • 49
Johan
  • 1,189
  • 3
  • 15
  • 28
  • 1
    I had this issue this morning when I found my system had rebooted after an automatic Windows Update and my open solution was *recovered*. Doing a rebuild of the solution did not clear the error, but simply expanding the `Dectected Dependencies` folder under the `Setup` project does. Closing the `File System (Setup)` tab, which opens when you view the `Dectected Dependencies`folder, and resaving the solution clears it for me. – Rich Shealer Aug 16 '12 at 08:10

4 Answers4

5

Yes there's clearly a way. Don't reference libraries from your disk folders or network places.

The right approach is to create a "Dependencies" folder (call it whatever you like) in the same place as where your solution file is. Copy in that folder every external resource and reference it from there.

Then remember to add that new folder and everything you will put in there to your versioning (SVN, HG, etc) so when the sources will be extracted to another machine, all the required dependencies will be there.

EDIT: just to be clear, this applies to libraries that are not part of the net framework, meaning they are not in the GAC. You should always reference CLR libraries from the GAC.

Matteo Mosca
  • 7,380
  • 4
  • 44
  • 80
  • 1
    But I don't. I let the setup project 'discover' the dependencies by itself. – Johan Jul 20 '11 at 14:22
  • What does it mean "you let it discover the dependencies by itself"? It doesn't make sense. Please clarify. – Matteo Mosca Jul 20 '11 at 14:49
  • When you add the output from a project to your setup project VS inspects the project and determines the dependencies based on the references in your project. Hope that makes more sense.... – Johan Jul 20 '11 at 18:35
  • Ok, but that is still related to what I told you. If your project references something from outside the solution folder, your setup project, when inspecting, will read that reference and use it. I still recommend you to move all your dependencies to a folder at the same level of your solution, then try and see if the error still occurs. – Matteo Mosca Jul 21 '11 at 07:18
  • 1
    I found the issue. If the project is closed and the 'File' view of the setup package is open, then on the next open of the project there is this issue. I'm putting it down to a subtle bug in the VS2010 user interface. The discussion above is however in general good to keep in mind. So, I'll mark this as the answer. :) Thanks for the help... – Johan Jul 22 '11 at 04:35
  • This answer clearly does not solve the problem, and should not be marked as an answer. My Visual Studio solution *is* set up as @MatteoMosca suggests, and Visual Studio (2010) still behaves in the buggy way described in the question. – Steven Magana-Zook Apr 05 '13 at 16:46
  • I'm sorry, but you're clearly doing something wrong. I've set up literally hundreds of visual studio solutions, and the problem described in the post is related to what I explained. You can post some screenshots or send me a zip of your solution and I'm sure I'll spot a problem like the one I explained. – Matteo Mosca Apr 05 '13 at 17:09
  • @MatteoMosca I have confirmed this is a bug in the Visual Studio IDE. If you open the solution in Visual Studio 2010, then the setup project will refresh the dependencies and give me the compile errors about missing file(s). However, if i use devenv.com from the command line with the /Build and other switches(bypassing the IDE GUI) then the setup project builds the MSI just fine. There is something in the IDE that messes these projects up. – Steven Magana-Zook Apr 05 '13 at 18:06
2

Removing the Read-Only attribute on the setup project's source folder fixed it for me.

wnutt
  • 519
  • 3
  • 5
  • If you are using TFS, like I am, then manually removing the read-only attribute has no affect. TFS will just fix those flags the next time you reopen the solution. – Steven Magana-Zook Apr 05 '13 at 16:47
2

Came across this answer while googleing and wanted to add my answer as the problem results in the same error message:

When toggling between Debug and Release builds, the build configuration was different for each build type. Debug would build, release wouldn't and vice versa. Changing the build configuration to match in Release / Debug via Solution > Properties resolved the issue.

gbro3n
  • 6,729
  • 9
  • 59
  • 100
-1

I'm just posting Rich Shealer's comment from above as that was what worked for me and it really should be an answer:

Doing a rebuild of the solution did not clear the error, but simply expanding the Dectected Dependencies folder under the Setup project does. Closing the File System (Setup) tab, which opens when you view the Dectected Dependenciesfolder, and resaving the solution clears it for me.

Curiously, I do not have any updates or anything like that going on. But I had just recently installed Office 2010 and specifically chose not to get automatic updates. Not sure if that had anything to do with, but glad it was quick and easy to fix.

Community
  • 1
  • 1
ouflak
  • 2,458
  • 10
  • 44
  • 49
  • @user1034912, Sorry this doesn't work for your situation, but it did work for atleast a couple of people. Normally I would only downvote an answer if it was of poor quality or failed to address the topic of the question or something along those lines. Not because it didn't provide a universal solution, i.e. worked for some but not for all. Just curious, you're still using Visual Studio 2010? Nothing wrong with that, but it is curious. – ouflak Dec 14 '18 at 07:11