LESS not compiling on Windows 2012 server? - css

This is my first time to use LESS in a project and it's not working when I publish to a server. Everything works fine when I run it locally in Visual Studio.
I'm running it in an MVC 5 application and after I was done I used Visual Studio to publish the files to a local folder. Then I copied the files over to the server. Initially the VS publish converted my Site.less file to Site.css and I figured that was the problem. So I researched and found that I could set the properties of the Site.less file's BuildAction=Content. Then the publishing locally created the Site.less instead of Site.css. However, when I copy that to the server the CSS isn't applied and when I browse to site.com/content/site.less I'm getting an error as though it's not compiling.
Looking around some more I found where someone said I had to set the MIME type in IIS but they didn't mention what the MIME time should be.
What do I need to do on the server get it my CSS to apply when using LESS?

Your server shouldn't compile LESS->CSS when your app is published. Your app should contain your css/min.css when published, not just your LESS file(s).

Related

ASP.NET website behaving differently when IIS is pointed at the source folder

I'm working on an ASP.NET website that I inherited, and I'm trying to set it up so I can run it and debug it through my local Windows 10 IIS instance. To get it up and running in Visual Studio I had to remove and re-add references, because I was receiving a Could not load file or assembly... error.
It runs via Visual Studio now, but when I point IIS at the same folder I get the very same Could not load file or assembly... error. Where in IIS I would need to adjust to resolve this?
I figured out this problem at least. I had to enable 32 bit support, which I got from this Infamous assembly binding error. Now I have a different issue I need to work through :o)

Publishing my asp.net mvc web application using Visual Studio Web Deploy will list some files as need to be deployed , although i did not modify them

I am working on an asp.net mvc-5 web application , and i am using Visual Studio 2013 , to publish my web application to an online hosting using web deploy.
now i published my web application correctly. and i check it online and every thing is working well.. then today i modify a view named "Contact.cshtml" and a file named "style.css", and then I try to publish again. i was expecting that only the two files will be shown in the preview window since they differ from the publish files. but i was surprised that my project.dll is being listed although i did not chnage it (i did not modify any cs file) and the modified date for this .dll is that same modified date which is online..so can anyone adivce on this ?
here is how the preview window inside VS 2013 looks like:-
So can anyone advice why my project.dll file is listed although i did not modify it since i did my last web deployment ?
Either you ran the project before publishing and/or your are building your views in the solution.
It may be that your style.css and Contact.cshtml files have the wrong Build Action. The proper build action for these files should be "Do not copy", which seems counter-intuitive since the Web Deploy will copy it anyway. You can change the Build Action by selecting each file in the solution explorer and setting the appropriate value.

Deploying a VS 2013 solution to an existing web application

Target Framework is 3.5 both on the web server and VS 2013. The existing web application is developed with VS 2008 and working smoothly. My solution is working nicely on local host. But when i deployed the solution to the server via ftp, i always face "could not load type:xxxx.aspx" error. I tried almost everything i see on several forums for the last 3 days(changing codebehind to codefile, web.config changes etc)
I think the solution to my problem may be:
Building solution locally, manually upload all aspx files, images, css files to the subdirectory. And manually upload all dll files to root/bin directory (or subdirectory/bin directory?)
Can anyone suggest anything for the supposed solution?
After trying many things, i've solved my problem as follows.
My Project is a solution working under a subdirectory of the main web page. This subdirectory has a /bin directory and VS20013 is putting the dll files into this directory. I keep receiving "Could not load type.." errors in all my attempts. When i copied all of my dll files from subdirectories /bin directory to the main site /bin directory everything worked fine. Pity for the time i've spent for changing my code for five days.
Hope this helps to somebody...

Turning a precompiled web app to a 'normal' web app

I've got a quick question about precompiled web apps:
I've recently took over a project done by someone else, which is a precompiled web app. This means that it has no App_Code folder, of course. Due to the nature of this project I would like to put my code on the server anyhow.
I can't just add the code, because I'll get an Exception stating that the App_Code folder isn't allowed because it's a precompiled web app. If I remove the file 'PrecompiledApp.config", then my application crashes.
So what are the correct steps in turning a precompiled web app to a compile-on-demand webapp?
Thanks for the help.
I can get this working in VS2010.
Go to your web app settings and select the Package / Publish Web tab. There's a drop down that's probably defaulted to 'Only files needed to run this application'. If I use this it just publishes the compiled DLLs to the server and the web files, but none of the code.
If I change this to 'All files in the project folder' then I get everything - all the C# code for my controllers, for example.
Of course whether you would want your production code on a server is a different question, and you also get all the VS solution files and stuff like that too so it looks quite messy.

VB.NET Application - Open website vs project file acts differently

I noticed one weird thing today, and I'll appreciate your input on this.
I was assigned to work on a VB.NET project. I took the project files from the server locally.
I opened Visual Studio and then did open project, the project loaded in the solution and I did build, I got errors, pls check screenshot:
http://gyazo.com/3fe2ea4d5ff8fd073355d43160861e70.png?1348166929
2nd try, I opened Visual Studio and instead open project, I did open website, I selected the folder where the files are located and then open website. I build the solution, it says build succeded and the website runs fine in the browser.
Now I want to know why that's happening, why when I am trying to open as a project I am getting errors, and when I am opening as a website, website starts ok.
Thanks in advance, Laziale
In VS, Projects and Websites are different - a Project is a collection of files managed by a *.proj file (e.g. *.csproj, *.vcproj, *.vbproj), whereas a Website is just a filesystem folder without much in the way of project management metadata.
The second main difference is that Websites have a different Build process - unless you explicitly opt-in to pre-compilation the project is not compiled at design-time, instead everything is compiled by the webserver at runtime, which means you need to distribute all of your source code.
It also means that compile-time errors are harder to detect. You will get the same errors in a Website as in a Project, it just means you need to perform a live website action that uses the same error-prone *.vb files, and you'll get a lovely YSoD error then (rather than in the IDE before you publish it).
"Websites" were introduced in VS2005 as an "easier" alternative to VS2003's ASP.NET Web Applications, but there was a lot of backlash from developers - I wouldn't be surprised if they removed it from a future VS release.

Resources