1

I have SomeDLL1 which have SomeFile.txt with this properties

BuildAction: Content Copy: Copy if never

I have SomeDLL2 which have a reference to SomeDLL1. I have ConsoleApp which have a reference to SomeDLL2. After any build of ConsoleApp i am need to rebuild SomeDLL1 for copying SomeFile.txt to ConsoleApp output directory. It is not comfortably. I can add a reference to SomeDLL1 in ConsoleApp to solve this problem. But i dont like it. May be there is some other solution?

Nodon
  • 967
  • 11
  • 24

1 Answers1

1

Check your solution's Properties > Project Dependencies.

Your ConsoleApp should depend on SomeDLL1. That means that SomeDLL1 will be re-built for each ConsoleApp build (automaticly) and all the references will be on place.

Actually, that is what you get with project dependencies after just normally create projects and adding references as you described. Possibly, you've unchecked this manually. Then check it back since it is not references but just solution build order tooling.

For older versions of Visual Studio (2010 and lower) there are some problems in described case. See: How to include neccessary files to the output of independent client project?

Community
  • 1
  • 1
astef
  • 8,575
  • 4
  • 56
  • 95
  • I don't quite understand you. When i add a reference to SomeDLL2 in ConsoleApp. Reference to SomeDLL1 must add automatically? Thx for url. I didn't know about add existing file like a link. It's funny, we are both from Russia, but speek in English :-) – Nodon Jul 14 '15 at 09:54
  • References are not the same as project dependencies. Your project `ConsoleApp` depends on `SomeDLL1` (through a `SomeDLL2`) but don't reference it. From my experience, VS always manages project dependencies correctly, after you specify references. – astef Jul 14 '15 at 09:59
  • You said if add references as i described. I decribed two type of reference, which of them did you mean? ConsoleApp depend to SomeDLL2. SomeDLL2 depend to SomeDLL1. I will get this dependencies if i add reference to SomeDLL2 in ConsoleApp and reference to SomeDLL1 in SomeDLL2. In this case file will not copy. If i just add dependency to SomeDLL1 in ConsoleApp without add a reference it will not copy file. – Nodon Jul 14 '15 at 10:23