Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 4 Jahren, 1 Monat
Letzter Beitrag:
vor 4 Jahren, 1 Monat
Beteiligte Autoren:
Pim Janssen, Jorge, Danny Lauwers

[WD19] Sharing Classes between projects ?

Startbeitrag von Danny Lauwers am 10.07.2014 07:50

Hi,

What is the best way of sharing classes between projects so that the class can be used in different projects and updates itself when changes where made.

I am using the SCM to store my code. I would not like to use a central folder if possible !

Thanks
Danny

Antworten:

There are several ways in SCM to share classes.

U can share a class directly. Only this file will be shared. If u update it in one project it will also be updated in all the other projects where u have shared this class with. U can do this by rightclicking on classes in project explorer and choose import class from SCM in a SCM managed project.

Most of the time i have a set of classes working together. If i share them all it works, but when i refactor the class of otherwise add a class or a Unittest file i have the problem i have to share this file for all my projects to work again. The solution of this could be internal components. This is a kind of folder u share between projects. If u add a extra class to a internal component all other projects will have this class also when u do a update.

Also it is possible to put some classes in a library and include / update this library when needed. But this solution is in my opinion the worst one.

External compontents is another way.

On each option there are some pro and cons to consider. Like for internal components u can't have a class with the same name in your project and in your internal component.

So depending on your needs u have to choose one of them and go for it. (there are maybe other options i missed but i think this are the most important onces).

Pim

von Pim Janssen - am 11.07.2014 14:23
Hi Janssen,

"share a class directly. Only this file will be shared."

From SCM?

How do you put any resource like a class in SCM and configure it as shared between two or more projects?

Thanks.
JJM

von Jorge - am 16.07.2014 22:55
If u want to share a set of classes (it can also include other elements like tests) i recommend looking into internal components.

Both your projects have to be in the same SCM and SCM has to be active for the project where u want to import/share the class. Right click classes (in the project explorer) "import a class from the SCM" In this window u can choose a class from the SCM. There are to buttons "share" & "copy".

More or less the same procedure can be used for other elements.

Pim

von Pim Janssen - am 17.07.2014 07:29
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.