문제

I have a solution with multiple projects in it.
And I have lots of pictures which two or three projects would need them.

How can I add these images once and share them across all the projects in the solution?

도움이 되었습니까?

해결책

Really depends on what you want.

  • You could use linked files. To do so simply have one "common" project with the resources and in the second project you use "Add Existing Item", before you click add, click the small arrow right to the button and say "linked file". This will not copy the file but keeps it in the current location. But it will treed it as if it is a normal project file...

  • If you just need static content shared across multiple web sites,

    a) have one web site storing the static content and reference all URLs to link to that static content web site.

    b) If you don't want to host a separated web site for the static content, simply create a sub website within each main web site...

  • If you have static content, create a virtual directory within your web site linking to a folder with all your static content.

다른 팁

Write a dll to hold all the resources and make them public, or my preference would be to add some methods to the dll to access named resources, e.g. public Stream GetImage("logo"), then reference it from your other projects.

Would be a couple of ways.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top