Best way to use a master page and its assets from a project into another project

174 views Asked by At

I wanna create in TFS (yes, sadly) a project with reusable code and resources to be reused in other projects. This project has a master page, its code behind (ugly name), a few classes with reusable code, and static assets like JavaScrit and CSS files.

I'm able to add in a project the reference to this reusable project. I'm able to create objects of its classes.

I then add that master page into local project (RightClick on the project > add existing item > select the master page on file system). With that, I can create an asp page (RightClick on the project > add new item > web form with master page, select the "remote" master page) and use it.

But when I run the project, the page is opened with broken references to all assets.

I'd need to create each folder and add each asset file one by one manually. And every time it's created a new asset file on the reusable project, I'd need to add it to each project that consumes it. That's deeply troublesome.

Is there a way to do this add existing file into a whole folder, and keep it synched from the reusable project? By synched, I include being able to change them in local project and have them updated on reusable project, be able to commit, etc.

I could use junction to make a NTFS shadow link of one folder to another, but then files would be replicated on TFS, without it knowing they are a unique file. I'd like to do this replication on TFS-side, so that it handles synching, merging, conflicts, locks, etc.

1

There are 1 answers

0
Hikari On

I did it. I embedded it into the DLL.

It was a little tricky and some code in that tutorial doesn't work anymore. But based on it I made it work.

When the aspx/ascx file is gonna be read from file system, it's instead read as resource from the DLL. A config adds it into the DLL.

I think it should work even for projects in different solutions. As long as the DLL is found by VisualStudio, or it is able to identify the project and compile its DLL, it should work.