Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

EDIT: This is a VS2008 app written in C#.

So I have a folder in my solution called

_lib/ 

It's where I keep my DLLs so that when I reference them, they get built into the bin/ folder.

Now I have a new item in my solution. It's a DLL but shouldn't be reference (it's required for a 3rd party app). So on build I want this to be copied from _lib/ to bin/ but NOT referenced in the project.

I've included the _lib/ folder in my app, and for the properties of that DLL I selected always copy. This ALMOST worked, it copies the file with the folder, so my structure looks like:

/bin/_lib/thedll.dll

Instead of

/bin/thedll.dll

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
226 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try following these steps in Visual Studio:

  • Expand the project tree concerned

  • Double click the Properties element

  • In the opened window click the Build Events tab

  • In the Post-build event command line text area place this:

    xcopy "$(ProjectDir)_libfile.ext" "$(ProjectDir)bin$(ConfigurationName)"
    
  • Open the expected output folder alongside Visual Studio

  • Hit CTRL+Shift+B to make sure everything is saved and build

  • Feel the sense of achievement well up inside you as your file appears

  • :)

Oh, and you can now set Copy to output directory to Do not copy.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...