-
Notifications
You must be signed in to change notification settings - Fork 521
No ResourceLoader for Angular component templateUrl in ASP.NET Core (.NET Framework) #1023
Comments
You need angular2-template-loader setup in your webpack config or be using ngtools/webpack to be able to handle string relative URLs like that. |
angular2-template-loader is already installed and configured in webpack: "angular2-template-loader": "0.6.2" module: {
rules: [
{ test: /\.ts$/, include: /src/, use: ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] } |
I'm surprised that you're seeing a difference in Webpack's behaviour based on whether your server is .NET Core or .NET Full Framework. Webpack should not know about or be affected by this. Can you track this down to a specific bug in code in this repo? If not, I'd guess it's more likely that there's some other difference between your two applications. |
I appreciate you guys taking time to help with this. As far as I've been able to tell, the issue pops up whenever .NET Framework is targeted instead of .NET Core. To demonstrate, I did a clean run of
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup>
When attempting to run the app at this point, the This demonstration is loaded into this GitHub Repo. |
I think the issue in your case is completely unrelated to what you're describing. I think the problem is that you've removed the You'll need to remove all the bad files and put |
Thanks @SteveSandersonMS! When I modified |
I would say that this is not closed. I am using the SPAtemplates outlined in this blog: "https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/" with visual studio 2017. Despite deleting and recreating the files this error persists. Switching to a standard inline template works but this breaks whenever a templateUrl is used. Is there anything that can be checked? Keep in mind that I've not modified the csproj file in any way - just adding new components. |
@mpalmer-sps Using the current templates (i.e., the Angular 4 template produced by |
Guys, Hope this will fix the issue |
Sounds like you have the wrong version of angular template loader @sujithpattambi |
I had the same issue and in my case, it was a comment in |
Built an ASP.NET Core (.NET Framework) Empty web project, and installed the following NuGet Packages:
Microsoft.AspNetCore (1.1.2)
Microsoft.AspNetCore.Mvc (1.1.3)
Microsoft.AspNetCore.SpaServices (1.1.1)
Microsoft.AspNetCore.StaticFiles (1.1.2)
Microsoft.Extensions.Logging.Debug (1.1.2)
Mirrored the
aspnetcore-spa
Angular template with the following modifications:ClientApp
(and all references) tosrc
semantic-ui-css
instead ofbootstrap
This same setup works fine in an ASP.NET Core web app that targets .NET Core, but when targeting .NET Framework, I get the following exception:
The only way to get rid of this error is to change component template URLs as follows:
to
The full project can be found in this GitHub Repo
The text was updated successfully, but these errors were encountered: