How to determine if a copy of Local is needed

I tried using System.Device in the Razor view of my C # MVC project. He complained that the link was missing even after I added it to the project. I didn’t have an assembly in my GAC, and for verification I added the bottom dummy line to my global.asax.cs file (and compiled with several debug flags turned on, I would not have thought it was optimized).

new System.Device.Location.GeoCoordinate();

as well as this line in my controller action:

System.Diagnostics.Debug.WriteLine(System.Device.Location.GeoCoordinate.Unknown.IsUnknown);

This was still not done. Finding this solution I checked my GAC, but it wasn’t there (which made sense, but it's good to check). After finding this solution, I marked the link as “Copy local” and the problem disappeared.

Why do I need to mark my link as "Copy local", although I explicitly called the library?

+6
source share
1 answer

If the DLL is not in a “detectable” location, such as a GAC ​​or path in a path environment variable, then you need to use a local copy to automatically move it (in the assembly) to the output directory, which (or rather, is on the path of investigation) .

+5
source

Source: https://habr.com/ru/post/1014271/


All Articles