Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在项目中包含捆绑包中的文件_C#_Asp.net Mvc_Bundle - Fatal编程技术网

C# 在项目中包含捆绑包中的文件

C# 在项目中包含捆绑包中的文件,c#,asp.net-mvc,bundle,C#,Asp.net Mvc,Bundle,我有一个包含2个项目(网站)的Visual Studio解决方案: 是否有办法使用捆绑包将项目B中的文件包含在项目a中 public static void RegisterBundles(BundleCollection bundles) { bundles.Add( new ScriptBundle("~/bundles/my_bundle") // This obviously doesn't work .I

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

是否有办法使用捆绑包将
项目B
中的文件包含在
项目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")
  );
}

您可以将来自项目A的文件添加到项目B,方法是链接它们而不是复制它们,然后添加到捆绑包中。请记住,您只能将文件作为参考添加到项目中

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")
  );
}