Visual Studio 2008 - 将构建时的文件移动到 bin/ [英] Visual Studio 2008 - Moving files at build to bin/
问题描述
这是一个用 C# 编写的 VS2008 应用程序.
所以我的解决方案中有一个名为
So I have a folder in my solution called
_lib/
这是我保存 DLL 的地方,因此当我引用它们时,它们会被内置到 bin/
文件夹中.
It's where I keep my DLLs so that when I reference them, they get built into the bin/
folder.
现在我的解决方案中有一个新项目.它是一个 DLL,但不应作为参考(第 3 方应用程序需要它).所以在构建时,我希望将其从 _lib/
复制到 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). So on build I want this to be copied from _lib/
to bin/
but NOT referenced in the project.
我在我的应用程序中包含了 _lib/
文件夹,对于我选择的那个 DLL 的属性,我总是复制.这几乎有效,它将文件与文件夹一起复制,所以我的结构看起来像:
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
代替
/bin/thedll.dll
有什么想法吗?
推荐答案
尝试在 Visual Studio 中执行以下步骤:
Try following these steps in Visual Studio:
展开相关的项目树
Expand the project tree concerned
双击Properties
元素
在打开的窗口中点击Build Events
标签
In the opened window click the Build Events
tab
在 Post-build event command line
文本区域中放置:
In the Post-build event command line
text area place this:
xcopy "$(ProjectDir)_libfile.ext" "$(ProjectDir)bin$(ConfigurationName)"
在 Visual Studio 旁边打开预期的输出文件夹
Open the expected output folder alongside Visual Studio
点击 CTRL+Shift+B 以确保所有内容都已保存并构建
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
:)
哦,你现在可以将Copy to output directory
设置为Do not copy
.
Oh, and you can now set Copy to output directory
to Do not copy
.
这篇关于Visual Studio 2008 - 将构建时的文件移动到 bin/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!