I am running into a dependency issue with MSBuild. I added a NuGet package for Microsoft.Tpl.Dataflow to a project in my solution. This is causing a build failure for a website project in the solution which references the first project. There seems to be an issue with getting the correct runtime version.
This is one of the many errors I get when building the solution with MSBuild.
C:\src\MyWebsite.metaproj : warning MSB3268: The primary reference
"C:\src\projects\ReferencedProject\bin\Debug\ReferencedProject.dll"
could not be resolved because it has an indirect dependency on the
framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
currently targeted framework. ".NETFramework,Version=v4.5". To resolve
this problem, either remove the reference
"C:\src\projects\ReferencedProject\bin\Debug\ReferencedProject.dll"
or retarget your application to a framework version which contains
"System.Runtime, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
The confusing thing to be is that the solution builds fine in Visual Studio. Also, all the other projects in the solution build—it's only the website projects that are failing.
I have tried
Changing the target framework for the website to 4.0 (it's currently 4.5).
Adding an assembly reference to System.Runtime.dll version 4.0.0.0
I still can't get it to build. How can I fix this?
Turns out aspnet_compiler.exe (which is called by msbuild) does not look for libraries in the Facade directory at
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facade
and as such, the website project in the solution would not compile.
I found this out from this blog post. As mentioned there, to fix the problem I copied the DLLs from the Facade directory into the v4.5 directory and everything works.
To be honest this is a less than ideal solution.
Related
Getting an
Could not load file or assembly 'System.Net.Http, Version=4.2.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file specified." exception
after publishing to Azure as an App Service.
I have created a ASP.NET Wep API application using Entity Framework DB First approach.
I did not use any NuGet package to install System.Net.Http, it was added automatically when the project was created. The latest version is 4.2.0.0.
It works fine when I run on my local IIS (IIS Express).
I published this app as an Azure App Service successfully but it does not open the API Home page. Instead I get the above mentioned exception.
I tried using bindingRedirect in Web.config but it does not help.
I am new to Azure and not sure how the dlls are deployed.
Any help is greatly appreciated.
Upgraded project to 4.7.2.
Turns out Visual Studio 2017, when installing the .NET 4.3.3 Nuget package for System.Net.HTTP is also adding DLL reference from the GAC. This in tandem with an Assembly redirect causes run time System.IO.FileNotFoundException looking for version 4.2.0.0 of System.Net.Http.
The good news, is to add references, uncheck System.Net.Http from the GAC (which was added automatically or by other developers in the project at one point in time), and simply delete the Assembly redirect.
For more details, you could refer to this article.
I think found the cause of the issue. My project is using .Net framework version 4.7.2 and on Azure the app service is using .Net framework version 4.7. So changing the target framework in my project properties to 4.7 seems to work.
I've ran into a weird problem.
I basically have my own web-stack for .NET-core which I've built into a few .dlls, and I want to reference these from another ASP CORE-solution.
VS seems to find the assemblies, where I can navigate types etc.
I can also build the project without any issues, but when IIS then runs the server I get an internal server error stating:
FileNotFoundException: Could not load file or assembly 'myDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
The referenced DLLs are in the debug-folder, and the really weird thing is that if I create a new ASP Core project in the same solution as the web-stack, I can reference and use it without any problems.
Why is this happening only when running on a project outside the web-stack's solution, and what can I do to make it runnable everywhere?
The .NET Core Tooling in VS 2017 (< 15.3 preview) / .NET CLI < 2.0 doesn't fully support referencing assemblies on disk. You need to package the library up as a NuGet package or use a project reference ("same solution"). The technical reason is that all the required assemblies and versions are resolved during compilation and written to the .deps.json file. When loading arbitrary assemblies, this might fail because either the assembly or its dependencies cannot be found (or a conflict with each other).
for load the external dll in core project, needed to:
vs 2017 with version 15.3 or upper.
Microsoft.Extensions.DependencyModel NuGet package installed in your project.
I want to use Deedle, but it complains like this:
Unknown build error, 'Cannot resolve dependency to assembly
'FSharp.Core, Version=4.3.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.'
Being an Android developer normally I'm a bit confused about VS dependencies.
I tried with the Package Manager Console, but it installs only 4.0.0.1 and doesn't know 4.3.0.0.
It seems it is solved with help from this question:
.NET runtime tries to load FSharp.Core 4.3.0 even if all projects reference 4.3.1
In the App.config file there was a binding redirect already to 4.4.0.0. I don't know if I added it earlier or Deedle. When I changed it to 4.0.0.1, which is apparently and confusingly the latest version of FSharp and I could download it with NuGet, it started to work.
I get the following error below after opening and compiling my VS 2010 .net 4.0 MVC3 project in VS 2012 RTM. How can I fix this without upgrading to MVC4?
I have VS 2010 and VS 2012 installed side by side.
Error 1 Assembly 'SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Another thing to check is that you dont have a test project still referencing the mvc3 assembly in the solution. Thats what got me.
Check your web.config. system.web/assemblies has version 3.0 even though your project references 4.0.
It was the case for me.
Go to References, Check the current version of System.web.mvc(I guess it is still pointing to mvc3). Remove them and add references once again, but this time System.Web.Mvc 4.0..!
If you are using multiple projects in a single solution then..
For e.g. you have two projects ProjA(MVC4) and ProjB(Still in MVC3),
if ProjA is has a reference of ProjB or using ProjB then it most likely to give the above mentioned error. You might have to change MVC versions in both the projects.
If you are using Visual Studio you can check for updates to your NuGet packages, which will update without the need to go messing around manually with the Web.config. Select tools -> Library Package Manager -> Manage NuGet Packages for Solution. Check you are on the most up-to-date version of MVC by selecting updates along the left hand panel, then in the list of updates look for MVC and click update. Once the update has finished click build and build solution. This was how I solved my issue that I was having between MVC and Fluent Validation NuGet package. And it automatically updates Web.config.
Using asp.net 4.5 and had a similar problem.
Right click on References and go to Manage NuGet Packages. Check to see if there is an update for the package with an outdated version.
May ask to overwrite files but that is ok.
I am new to winCE (.net 2.0) programming.
My project is in C# language. A guy before me was using log4net (Runtime version : V1.1.4322, Version 1.2.10.0). What does those versions means, Am I right V1.1.4322 means it was compiled on .net version 1.1.4322
Now the problem is if I compile it is giving me warning(s):
Consider app.config remapping of assembly "System.Data, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\System.Data.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System.Xml, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\System.Xml.dll] to solve conflict and get rid of warning.
Consider app.config remapping of assembly "System, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\WindowsCE\System.dll] to solve conflict and get rid of warning.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3247: Found conflicts between different versions of the same dependent assembly.
My application .exe is OK but when I am running WinCE Emulator it is crashing
I have worked with app.config, it didn't fix my problem
any suggestions ?
The problem you're seeing is you've got references to two different versions of log4net.
Check any referenced assemblies to see if you've got references in those projects. Then confirm the versions of any copies of the file you've got on disk.
It can be a pain to find the offending file; I've found the simplest thing is to find all copies on disk, and just delete all copies of the incorrect version. Then see where your project complains and adjust.
I'm not sure that you're having just a log4net problem.
The assemblies its complaining about are normal CLR assemblies (from the System namespace). It almost seems to me that you have references to several .NET 1.1 assemblies but you've got your project set to use .NET 2.0. The IDE is asking you to map the 1.1 assemblies to the 2.0 ones so that your project will know which one it should use at runtime.