Andrew
Andrew

Reputation: 5176

Visual Studio 2012 Website - Make Project Folder Mirror Explorer

I'm guessing there's a standard way to do this that I never learned... I have a VS solution with some folders in it, you know, Models, Views, Controllers, etc. I added a few custom ones like Styles, Scripts, and Images. Naturally, I started saving images for the site in the Images folder in Explorer that VS created. I was sad to learn, however, that these files don't just show up in my solution, therefore they don't get Web Deployed either. Bummer. What is the right thing to do here?

P.S. Some of you probably jumped when I said I made a Scripts folder. I know about the built in minification stuff, and I don't want to use it at this point. Thanks.

Upvotes: 2

Views: 1834

Answers (2)

Dan Nolan
Dan Nolan

Reputation: 4772

If you don't mind getting your hands dirty in the .csproj file, firstly remove any existing file references from the Images folder of the project and then insert this before the <Import> tags.

  <ItemGroup>
    <Content Include="Images\**\*.*" />
  </ItemGroup>

This will automatically include all files contained in the Images folder and its subfolders when the project is loaded.

Upvotes: 3

SLaks
SLaks

Reputation: 887767

Click Show All Files in the toolbar on top of Solution Explorer.
You can then right-click a file or folder and click Include in Project.

You also need to make sure that the files' Build Action is set to Content, but that should happen automatically.

Upvotes: 2

Related Questions