question

PaulJohnson-1741 avatar image
0 Votes"
PaulJohnson-1741 asked EricWoodruff-3184 edited

One Class, Multiple Projects

Hi guys!

This may be a silly question to ask but I am having an issue with keeping classes up-to-date across multiple projects. With my job I am trying to push out several different applications that all utilize specific classes but every time I need to implement a change for one application using one of these shared classes (the change would be in the class itself for the specified) I have to go and update all of the other applications using that same class because the class (example: ProductOrder) is technically viewed as different classes across the different applications (a different instance of the class's file for each application).

Is there a way that I can get a single class file to work across all of my different applications? I was thinking something like a reference but I don't know a lot about the ins and out of that.

Thanks!

vs-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

EricWoodruff-3184 avatar image
2 Votes"
EricWoodruff-3184 answered EricWoodruff-3184 edited

If you have several classes, you could create a class library project, put them all in that and add it as a project reference in the other projects. If it's just one source code file, you can remove the copies from all but one project. You can then add the file back to the other projects but use the Add Existing Item option. Navigate to the file's location and when adding the file, instead of just clicking the Add button, click the dropdown arrow on it and select the Add as Link option. It will add the item to the project but it will be a linked item. It will work just as if it was in the project when compiled but when you open it for editing, it opens the item in its original location. Changes made to it are then reflected in all of the linked locations too.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.