1

I am working on a Web application project and although I am an experienced Visual Studio developer almost all of that has been in WinForms, console apps, Services, etc. That is, I have very little experience with using VS to develop web pages (Web Forms, asp.net, etc.), however, I am learning how to apply my previous Web page knowledge to VS.

One thing that has been throwing me for a while is how to apply additional CSS files in development, that should not be used in production (because they are already there). Specifically, I am working on a set of pages (DNN module) that is being deployed into a larger website context.

This all works fine, except the VS Web Page Design Editor is nigh useless because it's WYSIWYG rendering is not even remotely close to what the page looks like on the site. I know why this is happening: the site (and DNN) have their own set of CSS files that are getting applied/added to the page.

I know that I could just add those same style sheets to my web page in development (using <link href=...> tags?), however, then the web page would be deployed referencing these CSS files twice (there's a bunch of them too).

So my question is, is there any easy solution to this? Is there some setting somewhere that I can just say "use these additional CSS files in development or in the Design Editor"? (I hHve tried to google this, etc. but I just find dozens/hundreds of articles about how to add or edit CSS in Visual Studio)


Unfortunately I think that may have mis-explained my need somewhat. The issue really is not a development vs production issues, but rather an IDE vs execution issue. When debugging the code or otherwise running it in development, it is still within the DNN test environment we have setup, so it does have the extra file even here.

This is really about the HTML designer, when i am using it it does not have these extra style sheets, so I cannot see what the work I am doing really looks like. Instead, i have to run it every time I want to see whether any change i make looks like it is supposed to. This gets extremely onerous, especially with how slow DNN is to compile and reload.

RBarryYoung
  • 55,398
  • 14
  • 96
  • 137
  • I have not used ASP.NET before, but couldn't you just use this? http://stackoverflow.com/a/1839564/1244910 - and just include the stylesheets if DEBUG is set to true. But I am not certain if the designer picks this up. – Thomas Glaser Mar 26 '15 at 16:00
  • 3
    You could add a condition that checks if the environment is localhost. If true then include the CSS files. – Kami Mar 26 '15 at 16:03
  • Good suggestions, but i am afraid i haven't explained myself sufficiently. It is not really a development/debug vs production issues, but rather an IDE vs execution issue. I will update my question. – RBarryYoung Mar 26 '15 at 20:42
  • 1
    @RBarryYoung Maybe IgnoreFileBuildProvider could help https://msdn.microsoft.com/en-us/library/aa479565.aspx#vs05webf_topic4 – easwee Mar 26 '15 at 21:47
  • @easwee That sounded good, but when I tried it, DotNetNuke threw an error: "*The element 'buildProviders' cannot be defined below the application level.*" Oh well. – RBarryYoung Mar 27 '15 at 13:47

1 Answers1

0

Hmm, do you have your web project setup to run on IIS instead of IIS Express? Something I do is often just work in the project then Save and if needed build. Then browse to the Site on my machines IIS instance (right click file in solution explorer and select browse if using ASP.NET Web forms).

Once I have done that I can refresh my page. I also use #if Debug in my code to bypass user login and etc to make round tripping faster...

Warren LaFrance
  • 552
  • 7
  • 20