4

In .NET Core, referred webpack bundles using asp-src-include. obviously main.js something like main.{hash}.js.

  <script type="text/javascript" asp-src-include="~/main*.js"></script>

Worked fine in .NET Core. But in .Net framework 4.5, obviously I can't able to useasp-src-include. So how to overcome this. src attribute not working like asp-src-include

 <script type="text/javascript" src="~/main*.js")"></script> //this is not working
4
  • would it help if the files are generated without hash, in that way you can simply include main.js without wildcard Commented May 13, 2020 at 16:31
  • 2
    No I need hash to solve the cache issue in production. Commented May 13, 2020 at 16:32
  • What is your Angular version? Do you use Angular CLI? Commented May 16, 2020 at 14:02
  • @ArunKumar Did you ever find a solution to this? Commented Sep 14, 2021 at 16:20

1 Answer 1

2

You can try some thing like this in the BundleConfig.cs

bundles.Add(new ScriptBundle("~/bundles/AngularMain").IncludeDirectory(
                 "~/Scripts/dist/","main.*"))

Refer them in you layout

@Scripts.Render("~/bundles/AngularMain")

you can find more info in this link Bundling and Minification I hope this might help

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.