问题
I had to have my primary HD replaced. Yesterday my HD was replaced by our IT tech staff. So today, after installing VS 2015, I started working on a WPF app we've been working on. I got into the project, did a Get Latest from TFS and did a build. I failed with the following error:
Cannot resolve dependency to assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
First of all, I've no idea why we even need System.Web. Secondly, it isn't in the references of any project in the solution. I know, I've looked, but in VS 2015 AND opening the .csproj files directly. So, what is trying to use it? What needs it? At this point I'm about ready to add it for no other reason then just to make it build.
回答1:
why we even need System.Web. Secondly, it isn't in the references of any project in the solution. I know, I've looked, but in VS 2015 AND opening the .csproj files directly. So, what is trying to use it? What needs it?
System.Web.Dll is old library responsible for whole http-protocol working. requests sending and creation. And you can find the system.web is member of system:
Besides, we can find the detail build log in the Visual studio Output, the system should be loaded, so if that assembly is missing or it is with a different version compared with the other referenced binaries, the assembly could not be loaded.
To resolve this issue, you could add it or create a new project with Visual Studio 2015 and copy the source files into this project. Then rebuild it, check if it works.
Hope those can help you.
来源:https://stackoverflow.com/questions/42681599/getting-an-error-cannot-resolve-dependency-to-assembly-system-web