.NET Core 1.1 MVC not rendering correctly via VS2017 IDE - asp.net-core-mvc

I have a simple .NET Core MVC solution based on a standard template which when started via the VS 2017 IDE does not seem to be rendering Bootstrap elements correctly. This happens whether I use IIS Express or Kestrel, and is browser-independent. But when I start it up from the prompt using dotnet run and browse to it manually it's fine. When I view the page source the correctly rendering version is (as per the environments defined in _Layout.cshtml) taking Bootstrap, JQuery et al from a CDN, whereas when run through the IDE it's using Bower\NPM packages under the web root.
I've tried rebuilding the dependencies to no avail. Static files are set. Any pointers as to what else to look at ?

You have to add app.UseStaticFiles(); line to your Startup class so your statics can be served by static files middleware

Related

Bootstrap 4 not loaded when publishing Core MVC site to Azure

I have a Core MVC application (.NETCoreApp 1.1) which I upgraded from bootstrap 3.3.7 to 4.0 (via Bower).
Everything renders as expected locally, but when publishing to Azure it goes wrong, on the server bootstrap 4 is not applied, the site is not rendered correctly.
With the Chrome developer tools I can see that locally the bootstrap 4 css is loaded correctly from the lib folder, on the server I don't even see a lib folder.
I tried a lot, I even deleted all files on the server and published the site again, with the same result.
This is bugging me for hours, can somebody help me?
Edit 28/01/2018 21:21
On the server I can see bootstrap 3.3.7 is still loaded via aspnetcdn.com
did you change the conditional in the _layout.chstml for Staged, Production to point to 4.0 cdn
since publishing usually results in a "release" non-development build it sets the environment to production or staged. the conditional will default to what ever is set there.

Visual Studio 2015/2017 +react +typescript

Have anyone found a complete react+typescript-tutorial in Visual Studio 2015/2017 MVC-project that works, from start to finish?
Ive tried to just get the NuGet-packages named "Reactjs Mvc4" and "typescript", created a .tsx-file, and copied some of the .config/package-files(from guide below), but the more I google, the more extra stuff I seem to be needing. In the end gets me different kinds of errors.
This one seems ok. It does produce all .config/.package-files one the correct locations, but it seems to assume you are using VS Code.
Hi check this cool template its good beginning for react typescript redux and router.
JavaScriptServices
You can generate VisualStudio project.
Form GIT:
JavaScriptServices is a set of client-side technologies for ASP.NET Core. It provides infrastructure that you'll find useful if you:
Use Angular / React / Vue / Aurelia / Knockout / etc.
Build your client-side resources using Webpack.
Execute JavaScript on the server at runtime.
Read Building Single Page Applications on ASP.NET Core with JavaScriptServices for more details.
This repo contains:
A set of NuGet/NPM packages that implement functionality for:
Invoking arbitrary NPM packages at runtime from .NET code (docs)
Server-side prerendering of SPA components (docs)
Webpack dev middleware (docs)
Hot module replacement (HMR) (docs)
Server-side and client-side routing integration (docs)
Server-side and client-side validation integration
"Lazy loading" for Knockout apps
A Yeoman generator that creates preconfigured app starting points (guide)
Samples and docs
It's cross-platform (Windows, Linux, or macOS) and works with .NET Core 1.0.1 or later.

Simple Membership needs System.Web.WebPages.Razor ( asp Web Forms)

I've added Simple Membership to my Asp WebForms application and when i run the application it tells me that
Could not load file or assembly 'System.Web.WebPages.Razor,
Version=3.0.0.0
why is that??
can i use Simple Membership with Asp WebForms?
Yes - can use simple membership with webforms, as described in:
http://blog.osbornm.com/2010/07/21/using-simplemembership-with-asp-net-webpages/
and http://www.mono-software.com/blog/post/Mono/226/Adding-ASP-NET-SimpleMembership-to-an-existing-MVC-4-application/
I am using in an Azure Cloud Service that ran fine locally, but ran into problems when publishing to the Cloud. This was resolved by removing references to WebMatrix.Data and WebMatrix.WebData (v2.0.0.0 manually added as per 2nd link above), then adding NuGet Package Microsoft.AspNet.WebHelpers to the project. This added references to v3 of WebMatrix with Copy Local = True. Downside is the NuGet package includes a load of other stuff that I don't actually need.
Hope that helps.

Should I use App_Themes or Content/themes in MVC4?

Up until now I had been using MVC3 for my apps but with the new update of Visual Studio 2012 I got MVC4. I migrated a few of my apps and now they are broken.
I noticed that the new project template for an Internet application creates a ~/Content/themes/base folder.
And yet, up until now I had been accustomed to use the App_Themes folder for that. In fact, with VS.2013 you can use "Add ASP.NET FOlder | Themes".
So I am now confused with MVC4, has It deprecated the App_Themes folder (which seems more appropriate to me than ~/Content) ? or is there a significant difference?
App_Theme come from ASP.NET Platform and one goal of mvc is get a clean html code
One of the things that ASP.NET MVC is missing is the ability to
easily implement Themes. The older, more mature standard ASP.NET
framework includes theme support via the App_Themes folder; however
limited it can be, it’s still more than ASP.NET MVC currently has.
Well, at least until I wrote this little custom ViewEngine and
ControllerBase class to help out and allow us to very easily implement
Themes within our ASP.NET MVC applications
take a look this helpful article this link

Problems installing a windows service

I'm attempting to install a Windows Service. I've tried it from within Visual Studio 2010 and also by just double clicking the msi. I followed the walk through here:
http://msdn.microsoft.com/en-us/library/zt39148a.aspx
The problem seems to be an nhibernate mapping exception.
I have a class library with hbm.xml files (yes, they are included as resources) and my entity classes.
I don't understand what I need to do to deploy everything correctly.
A couple of suggestions: First, make sure your project type is a console application. That will ensure that your app.config is seen and renamed/copied correctly. Second, the business of installing and uninstalling (the windows service) is really best done with an open source project called TopShelf. I've personally had great experiences using TopShelf to bootstrap Windows Services. The documentation is a little spartan but there is a simple example to get you up and running quickly. Simply put, it handles all of the messy plumbing to get the service installed and uninstalled by exposing a simple to use command line interface.

Resources