简体   繁体   English

Visual Studio 2008 - 将构建时的文件移动到bin /

[英]Visual Studio 2008 - Moving files at build to bin/

EDIT: This is a VS2008 app written in C#. 编辑:这是一个用C#编写的VS2008应用程序。

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. 这是我保留我的DLL的地方,以便当我引用它们时,它们被内置到bin/文件夹中。

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). 它是一个DLL,但不应该是引用(它是第三方应用程序所必需的)。 So on build I want this to be copied from _lib/ to bin/ but NOT referenced in the project. 所以在构建时我希望将它从_lib/复制到bin/但是在项目中没有引用。

I've included the _lib/ folder in my app, and for the properties of that DLL I selected always copy. 我在我的应用程序中包含了_lib/文件夹,并且我选择的DLL的属性总是复制。 This ALMOST worked, it copies the file with the folder, so my structure looks like: 这个ALMOST工作,它用文件夹复制文件,所以我的结构如下:

/bin/_lib/thedll.dll

Instead of 代替

/bin/thedll.dll

Any ideas? 有任何想法吗?

Try following these steps in Visual Studio: 请尝试在Visual Studio中执行以下步骤:

  • Expand the project tree concerned 展开相关的项目树

  • Double click the Properties element 双击Properties元素

  • In the opened window click the Build Events tab 在打开的窗口中,单击“ Build Events选项卡

  • In the Post-build event command line text area place this: Post-build event command line文本区域中放置:

     xcopy "$(ProjectDir)_lib\\file.ext" "$(ProjectDir)bin\\$(ConfigurationName)" 
  • Open the expected output folder alongside Visual Studio 与Visual Studio一起打开预期的输出文件夹

  • Hit CTRL + Shift + B to make sure everything is saved and build 点击CTRL + Shift + B确保所有内容都保存并构建

  • 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 . 哦,您现在可以将Copy to output directory设置为Do not copy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM