Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.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_Owin_Precompile - Fatal编程技术网

C# 生成工作正常,但在发布期间预编译失败

C# 生成工作正常,但在发布期间预编译失败,c#,asp.net-mvc,owin,precompile,C#,Asp.net Mvc,Owin,Precompile,在以下情况下不存在任何问题: 建设项目 通过IIS Express以调试模式运行 通过IIS以调试模式运行 在“预编译”关闭的情况下发布到服务器 发布设置: 其他信息: “不合并”选项有效 在“csc.exe”期间失败 错误: 命名空间“Microsoft”中不存在类型或命名空间名称“Owin”(是否缺少程序集引用?) 文件: 属性\AssemblyInfo.cs 来自AssemblyInfo.cs using Microsoft.Owin; .... [assembly: OwinS

在以下情况下不存在任何问题:

  • 建设项目
  • 通过IIS Express以调试模式运行
  • 通过IIS以调试模式运行
  • 在“预编译”关闭的情况下发布到服务器
发布设置:

其他信息:

  • “不合并”选项有效
  • 在“csc.exe”期间失败
错误:

命名空间“Microsoft”中不存在类型或命名空间名称“Owin”(是否缺少程序集引用?)

文件:

属性\AssemblyInfo.cs

来自
AssemblyInfo.cs

using Microsoft.Owin;
....
[assembly: OwinStartup(typeof(MyNameSpace.MyProject.Startup))]
using Microsoft.Owin;

[assembly: OwinStartup(typeof(MyNameSpace.MyProject.Startup))]
发展环境:

  • Visual Studio 2012
  • 视窗10

    • 无论出于何种原因,在发布过程中都没有正确的参考资料(我很想知道原因,但我无法弄清楚)

      要解决此问题,只需将Owin代码移动到新文件
      AssemblyInfo.Owin.cs

      using Microsoft.Owin;
      ....
      [assembly: OwinStartup(typeof(MyNameSpace.MyProject.Startup))]
      
      using Microsoft.Owin;
      
      [assembly: OwinStartup(typeof(MyNameSpace.MyProject.Startup))]