te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>asp.net - FileNotFOundException on runtime - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net - FileNotFOundException on runtime - Stack Overflow

programmeradmin3浏览0评论

I have an old asp website that references a Framework 4.8.1 Class Library.

I wanted to use this class library in other class libraries that are going to be 8.0. I decided to retarget this class library to standard 2.0. I had quite a bit of work recording stuff and moving some out of it to a different library but after a bit of work everything compiled again.

However when i now try to run that asp website i get a runtime error of:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

The asp website did indeed still have a reference to this version. I have however deleted this and added a reference through nuget for the 5.0.0 version (same as I have in the net standard class library). But this error keeps popping up. The module reporting the error is the net standard class library. I have no other references anywhere to that version of annotation, all other libraries also use 5.0.0.

Any suggestions?

I have an old asp website that references a Framework 4.8.1 Class Library.

I wanted to use this class library in other class libraries that are going to be 8.0. I decided to retarget this class library to standard 2.0. I had quite a bit of work recording stuff and moving some out of it to a different library but after a bit of work everything compiled again.

However when i now try to run that asp website i get a runtime error of:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

The asp website did indeed still have a reference to this version. I have however deleted this and added a reference through nuget for the 5.0.0 version (same as I have in the net standard class library). But this error keeps popping up. The module reporting the error is the net standard class library. I have no other references anywhere to that version of annotation, all other libraries also use 5.0.0.

Any suggestions?

Share Improve this question asked Feb 17 at 13:18 Thierry VerhaegenThierry Verhaegen 1852 silver badges12 bronze badges 3
  • your .NET Standard library was still looking for version 4.2.0.0, try to add the appropriate binding redirect to your web.config – Roman Marusyk Commented Feb 17 at 23:39
  • Please try to use Fuslogvw.exe (Assembly Binding Log Viewer) to check the issue. – Jason Pan Commented Feb 18 at 2:22
  • I tried adding binding redirects, did not work. I then decided to try and multi target net481;netstandard2.0 and then the build works locally, and also runtime works. I have problems on team foundation on prem build pipelines, but that's another issue i will create a new post for – Thierry Verhaegen Commented Feb 18 at 12:56
Add a comment  | 

1 Answer 1

Reset to default 1

I changed the project to multi target frameworks and this fixed the runtime error(s).

发布评论

评论列表(0)

  1. 暂无评论