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

时光总嘲笑我的痴心妄想 提交于 2019-12-24 16:58:36

问题


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:


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.



来源:https://stackoverflow.com/questions/31009615/best-way-to-use-a-master-page-and-its-assets-from-a-project-into-another-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!