在项目中捆绑包含文件

Ale*_*edo 5 c# asp.net-mvc bundle

我有一个Visual Studio解决方案,其中包含2个项目(网站):

Solution
  - Project A
      - App_Start
         - BundleConfig.cs
      - Scripts

  - Project B
      - App_Start
      - Scripts
         - my_file.js
Run Code Online (Sandbox Code Playgroud)

有没有办法使用捆绑包包含来自Project Bat的文件Project A

public static void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(
         new ScriptBundle("~/bundles/my_bundle")
              // This obviously doesn't work
              .Include("~/../Scripts/my_file.js")

              // Neither does this
              .Include("../../../Scripts/my_file.js")
  );
}
Run Code Online (Sandbox Code Playgroud)

Ant*_*cca 1

您可以通过链接而不是复制来将来自项目 A 的文件添加到项目 B,然后添加到您的包中。请记住,您可以将文件添加到项目中,仅供参考。