Quantcast
Channel: How to automatically copy embedded resources from class library that is referenced by another class library? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by devuxer for How to automatically copy embedded resources from class library that is referenced by another class library?

$
0
0

I think you need to mark it Content+ Copy Always.

Refer to this page for details on the different Visual Studio file properties.


Update 1

Try creating a link to the file in your web application project. You can do this by...

  1. Right-click your web project (or a folder inside it) using Solution Explorer
  2. Select Add > Existing Item
  3. Navigate to your file and select it
  4. Click the little arrow on the right side of the Add button and choose Add As Link

Update 2

Using Content / Copy Always on any file in a referenced library project should cause the file to be copied to the bin folder of the main project. If the file is in a folder, it will be in that folder in the bin folder.

Make sure that if you are doing a Release build, you are looking bin/Release, and if you are doing a Debug build, you are looking in bin/Debug.

Also, try doing a Rebuild All.


Update 3

I see what you're saying now. When you reference a library DLL that is not in your solution, you are only referencing the DLL, not anything else that is in that project.

So, I think you are going to need to do one of the following...

  1. Include that project in your solution
  2. Link to the file (as in Update 1)
  3. Create a new project called something like MyLibraryContentFiles that has only the content files of the library project, but not the code, and include this project in your solution. You might find that separating the content files from the code is advantageous anyway.
  4. Embed any files you need within the library project (DLL) (using Embedded Resource), then provide a property on a public class that provides some kind of interface for referencing the file. If it's an image file, you could return an Image object. If it's a text file, you could return a plain string.

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>