Nodon
Nodon

Reputation: 1027

How to copy some file to output directory through 2+ projects

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?

Upvotes: 1

Views: 87

Answers (1)

astef
astef

Reputation: 9508

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?

Upvotes: 1

Related Questions