English 中文(简体)
多个项目使用的更新课程?
原标题:Updating classes used in multiple projects?

我有几门课,以我能用于多个项目的方式进行总结。 我总是在这些班子上工作,优化、增加等。 因此,当我优化其中一个类别中的内容时,我需要把这一新版本复制到我所记住的每个项目中。 这不是一种非常好的做法,而是有更好的办法?

增 编

最佳回答

www.un.org/Depts/DGACM/index_spanish.htm 不是通过人工复制更新的班级,而是创立一个Class Library项目,并在每个使用这些班次的项目中查阅汇编的文件。 安排你这样的班级,将有助于你遵循“DRY”原则。


If you need to reference files instead of compiled libraries, however, you can reference a file as a link so that multiple projects refer to the same file without copying it to each solution folder. To do that, right-click on your project, choose Add existing item..., browse to the .cs file, and choose Add as Link from the combobox in the right lower corner.

问题回答

在单一项目中开设这些基类课程,并在作为参考类别图书馆的不同解决方案之间分享这一项目。 这样,你就不必在项目或解决办法之间复制/复制任何东西,而所有东西都应当永远是最新的。

You could even set-up a local NuGet feed so you can use NuGet to retrieve this shared project as a reference in a well structured and managed way.

如何将课堂带入单独的项目,并在你正在使用的每一项目中增加该项目的内容?

在整个申请中复制过去档案是坏的。 为了避免重复:

  1. make a link, if the amount of file is really small . In the Solution browser of Visual Studio, right click, Add Existing file, chose your file and in the split button, choose Add as a link
  2. create a separate project and reference this project wherever is is necessary if the amount of files not tiny.

建立基调,将其建设到“共享”地点。 在你的项目中添加提及的内容。 它将缩小其他项目的规模,并加快建设。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签