准备发布源代码
这里有一个新手问题。
在VC# 2010 Express中,有没有一种简单的方法来准备要发布的源代码?换句话说,删除任何不应该发布的文件,例如关键文件、用户特定的设置等。
如果没有,有人可以向我指出清单或类似性质的东西吗?
Bit of a newbie question here.
In VC# 2010 Express, is there an easy way to prepare source code to be released? In other words, strip out any files that shouldn't be released like key files, user-specific settings, etc.
If not, can someone point me to a checklist or something of that nature?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道一种内置的方式(尽管我从未寻找过);毫无疑问,包含的内容会因项目而异,并且很难以自动化的方式正确完成。以下是要包含和排除的内容的一般列表(我的脑海中浮现出来):
要包含的内容
我发现一个很好的经验法则是“包含源代码控制下的所有内容(源代码控制元数据除外)”。基本上:
)不包括
密钥文件是一种有趣的情况 - 如果您使用它来创建强名称程序集,那么您可能需要也可能不需要向公众发布该密钥文件。一方面,它使某人更容易更改您的代码并签署生成的程序集,但另一方面,有人可能对您的代码进行恶意更改,然后签署程序集。有关是否发布关键文件的更完整讨论,请参阅此问题或不。
这应该涵盖项目目录中的大部分文件——如果我遗漏了任何内容,请告诉我!
I don't know of a built-in way (though I've never looked for one); what to include will undoubtedly vary from project to project, and would be tricky to get right in an automated way. Here's a general list (off the top of my head) of what to include and exclude:
What to include
I've found a good rule of thumb to be "include whatever's under source control (except for source control metadata)". Basically:
What not to include
Key files are an interesting case -- if you're using one to create strongly-named assemblies, then you might or might not want to release that key file to the public. On one hand, it makes it easier for someone to make changes to your code and sign the resulting assembly, but on the other hand, someone could make malicious changes to your code then sign the assembly. See this question for a more complete discussion concerning whether to release key files or not.
This should cover most of the files in your project directory -- let me know if I've missed anything!
这就是我通常做的事情。
删除以下所有目录:
删除以下文件(递归地):
这应该会给你一个非常干净的项目来压缩。
Here's what I normally do.
Delete all the following directories:
Delete the following files (recursively):
That should give you a pretty clean project to be zipped up.
一个值得遵循的好规则是
.gitignore
文件的规则列表。请参阅此答案作为一个良好的起点。A good rule to follow is the rule list for a
.gitignore
file. See this answer for a good starting point.