MS Visual Studio 2010 - Development & Debugging with external .css files

Our website uses the following folder structure;

wwwroot
     _Styles
     _Images
     _JavaScript
     Application 1
     Application 2
     Application 3
     etc.

My development system uses the same structure.

All of our .css files are contained in the _Styles folder at the wwwroot level, not with the individual application. Our HTML markup would typically include a link to the .css such as;

<link rel="stylesheet" href="/Styles/our.css" type="text/css" />

When I am developing or modifying an application I will run the application on my local system in debug mode to test the code.

Is it possible to get Visual Studio 2010 to include the .css files in _Styles folder when I run the application on my local system, so that I can see the webpage rendered correctly?

It seems the only way I can do so is to move or copy the relevant .css files into my local application, which I do not want to do.

I am using Visual studio 2010 and .Net Framework 4.0

Thanks for your help.
ordoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
wwwroot
     _Styles
          style1.css
     _Images
          myimage.jpg
     _JavaScript
           coffee.js
     Application 1
       index.aspx
to access myimage.jpg from index.aspx
 <img src="/../_Images\myimage.jpg" alt="Test Image">
..\ to go up 1 directory
_images\  the directory path name
myimage.jpg  the filename

http://q28683425.azurewebsites.net/%5CApplication1%5CHtmlPage.html
ordoAuthor Commented:
David,

Thank you for your reply. I copied the HTML source from your link into a new VS 2010 project;

<!DOCTYPE html>

<html lang="en">
    <head>
         <title>Path</title>
    </head>
    <body>
        <img src="/../_Images\Shutterstock_71036254.jpg" alt="Shutterstock" style="width: 128px;height: 128px;">
     
    </body>
</html>


When I run it on my local system the image is not found. I attached a screen shot.

Pat
2015-06-08-0957.png
ordoAuthor Commented:
David,

Sorry I posted the wrong HTML code. Here it is with an image source on my local machine (C:\inetpub\wwwroot\images\25Years_trans.gif)

<!DOCTYPE html>

<html lang="en">
    <head>
         <title>Path</title>
    </head>
    <body>
        <img src="/../Images\25Years_trans.gif" alt="Cancel">
     
    </body>
</html>


However I get the same result. The image is not found.

Thanks for your help.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ordoAuthor Commented:
Problem solved.

I created virtual links to the Styles, Images, and JavaScript folders on my local system (c:\inetpub\wwroot\styles\...").

Now when I run the project locally, I see the rendered pages with the css styling and images, etc.

When a project is promoted onto our production web servers, a virtual links ares created to the same folders on the production servers.

We use Aldon software to handle our version control and project promotion, so it's fairly easy to create the virtual folders on the production servers as part of the Aldon deployment.

The nice thing about this solution, I don't have to change any links when the code is moving between Development, Quality Control,  and Production.

Pat

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David Johnson, CD, MVPOwnerCommented:
<img src="/../_Images/
 <img src="/../Images\

use forward slashes not back slashes. you don't need virtual directories.
ordoAuthor Commented:
Thanks again, but I tried your example;

<img src="/../_Images\Shutterstock_71036254.jpg" alt="Shutterstock" style="width: 128px;height: 128px;">

 which seems to include both forward and backward slashes. I cut and pasted it into a new project, and then tried every combination of slashes.

However MS Visual Studio only seems to recognize objects contained within the application when  running locally in debug mode. Objects, pictures, .css files, etc.  located in folders external to the application, regardless of path, are not found.

I appreciate your help, but the virtual folder has been the only solution I've found, that actually works.
ordoAuthor Commented:
Using virtual directories works with MS Visual Studio running locally in debug mode. Other suggested solutions only seem to work when the application is published to our public website, which is not the issue.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.