Asp.net Core 2 - Angular template (One Solution) - aspnetboilerplate

I have some problems to start the project after downloading the ASP.NET Core with Angular One soluton template.
I start it with iis express but the client app don't start.
https://aspnetboilerplate.com/Pages/Documents/Zero/Startup-Template-Core
Any suggestion?

You cannot run/debug angular project from VS. Because the Angular project is running with using Angular-CLI. For debugging check following links.
How to debug Angular JavaScript Code
https://www.pluralsight.com/guides/front-end-javascript/debugging-angular-2-applications
Try Visual Studio Code and add the Chrome debugging extension and add a configuration to launch.json something like this.
{
"version": "0.2.0",
"configurations": [{
"name": "Launch Chrome against localhost",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"sourceMapPathOverrides": {
"webpack:///./*": "${workspaceRoot}/*"
}
}]
}
You can also refer this document for more details.
https://code.visualstudio.com/docs/languages/typescript

Merged solution is a structure where angular and host project files are located in the same directory. that doesn't mean host and client app start within IIS Express. So you cannot run Angular in IIS Express. Just run npm start.

Related

How to manage ASP.NET Core web.config when using Visual Studio IIS debugging?

Visual Studio supports development-time IIS Support for ASP.NET Core (https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?source=recommendations&view=aspnetcore-7.0), e.g. I can debug a .NET 6 web app against local IIS from within Visual Studio.
In my particular case, I have set up a launchSettings.json file with my IIS settings, including environment variables for testing locally, like in the example:
"profiles": {
"IIS": {
"commandName": "IIS",
"launchBrowser": true,
"launchUrl": "https://localhost/WebApplication1",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
What this does is at runtime when debugging locally, Visual Studio creates a web.config file in the project directory. That's all good, makes sense, and local debugging works great.
I'm wrestling with how to manage the web.config beyond that. In the example above publishing as-is will keep the ENVIRONMENT set to "Development" unless I change something. I don't want my local environment variables from launchSettings.json to make it to the deployed build. I could make a web.Release.config transform and clear out the <environmentVariables> element.
But ideally I think I would have the build generate a new web.config each time, as it would do if I didn't have the existing web.config that was auto-generated from the debugger launch profiles.
What is the recommended way to deal with this, assuming that I just want the stock web.config behavior and don't actually have any embedded environment variable settings I want to include? Go with the transforms and remember to include that in any future projects? Is there any way to keep the local IIS debugging settings in launchSettings, but have the project somehow know to ignore that web.config on Release build and create from new?

Visual Studio 2015 .NET Core 1.0 Autobuild

I am working on a .NET Core 1.0 web application in Visual Studio 2015 Community.
Apparently there is an autobuild function, where I should be able to run without debugging (ctrl+F5) and any changes I make to my code should be reflected simply by refreshing the page, but I cannot get this working.
Any changes I make to my views is reflected with a page refresh regardless of whether or not I am running with or without debugging (F5 or ctrl+F5), but any changes I make to controllers or other code is not.
When I run with or without debugging, I get a command prompt that shows up.
If I run the project without debugging and then try and build, I get the following error
Projects\MyProject\bin\Debug\netcoreapp1.0\ASPNET_Core_1_0.dll' for writing -- 'The process cannot access the file 'C:\Users\Adam\Desktop\Visual Studio Projects\MyProject\bin\Debug\netcoreapp1.0\ASPNET_Core_1_0.dll' because it is being used by another process.'
So if I run a project without debugging, I need to close this command prompt, and then re-run with or without debugging to see the changes.
Any help would be greatly appreciated.
I've noticed that if I run my application with IIS Express without debugging, I can get this autobuild function. After I make some changes in my code, I can get that result by pressing F5 in the browser.
However, if I run it directly using WebApplication as target, I cannot get this autobuild function. I have to modify project.json as in the example below:
"tools": {
"Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final"
},
And I have to add some lines in the profiles section to launchSettings.json in the Properties folder:
"dotnet watch": {
"executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
"commandLineArgs": "watch run --server.urls http://*:5000",
"launchBrowser": true,
"launchUrl": "http://localhost:5000/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
After that, I can get this autobuild fuction by selecting dotnet watch as the target, with or without debugging. Thanks to asp.net core and Rehan Saeed.

appsettings.json in Deploy folder not updated to show production connection strings

I am developing a .Net Core web application using a fully patched version of Visual Studio Professional 2015 Update 3.
In the root of my application, I have the standard appsettings.json file and a appsettings.Production.json file. The appsettings.Production.json has different values for some of the attributes. The appsettings.Production.json file appears nested correctly in Visual Studio's solution explorer.
I have a Configuration Manager entry called Production. I have a File System publish job setup also called Production which pushes files into a folder named /Deploy
When I publish, the appsettings.json file is pushed into the /Deploy folder but it just contains the default values instead of the ones in appsettings.Production.json. No matter what I do I can not get the production values to push into the appsettings.json file.
appsettings.Production.json should be published as a separate file, it does not replace content of appsettings.json during publishing.
You should add appsettings.Production.json into publishOptions section in project.json file:
"publishOptions": {
"include": [
"appsettings.json",
"appsettings.Production.json",
...
]
},
and add it when construct ConfigurationBuilder :
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)

MVC6 Web Project Grunt Start Debugging

I am working on a web project which is using the next version of MVC. I have a gruntfile setup and was hoping to set it up to start debugging (F5) for me. Is there a plugin to do this or has this not been done yet?
You can add "prepare": ["grunt"] in your scripts inside of the project.json

Glimpse execution tab disabled for MVC3

I have just installed Glimpse for MVC3 from nuget and I have logginEnabled set to true in web config but still do not get the "Execution" tab. This is on IIS Express.
I have another project which does not use IIS Express (uses visual studio dev web server) and I can see the execution tab.
I have checked my web.config and I have all the sections configured.
Any ideas?

Resources