Ian*_*cer 11 c# asp.net vs-web-site-project .net-standard
使用.NET 4.6.2和较旧的Web站点(非Web应用程序)项目.如果我清除BIN目录然后构建并运行它可以工作,但有时在多次构建和运行之后,它会因此错误而失败.
Server Error in '/' Application.
Cannot load a reference assembly for execution.
....
[BadImageFormatException: Cannot load a reference assembly for execution.]
[BadImageFormatException: Could not load file or assembly 'netfx.force.conflicts' or
one of its dependencies. Reference assemblies should not be loaded for execution.
They can only be loaded in the Reflection-only loader context.
(Exception from HRESULT: 0x80131058)]
....
Run Code Online (Sandbox Code Playgroud)
当他们使用的库开始引入netstandard 2.0时,是否有任何技巧可以使Web站点项目正常工作?
此外,似乎这个程序集绑定重定向是必要的,以使其运行,但nuget添加重定向到旧版本4.1.1.0.除了在大多数nuget更新后手动编辑此行之外,有关如何解决此问题的任何建议吗?
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
如果将项目迁移到Web应用程序项目,是否所有这些问题都会消失?
小智 -1
是的,您可以将网站转换为网络应用程序:
如果您看不到此配置 - 可能您的类名称有问题,例如:
/目录/Index.aspx.cs
/Directory2/Index.aspx.cs
| 归档时间: |
|
| 查看次数: |
4122 次 |
| 最近记录: |