VS2017 Could not load file or assembly Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll or one of its dependencies

I had a similar issue (with the additional message The “BuildShadowTask” task failed unexpectedly) with a project originally developed with VS2010, and got to spend the last few hours learning about yet another legacy facet of the build process. There is a good chance that you are dealing with private accessor files (.accessor), which were … Read more

C# string replace does not work as it doesn’t replace the value [duplicate]

The problem is that strings are immutable. The methods replace, substring, etc. do not change the string itself. They create a new string and replace it. So for the above code to be correct, it should be path1 = path.Replace(“\\bin\\Debug”, “\\Resource\\People\\VisitingFaculty.txt”); Or just path = path.Replace(“\\bin\\Debug”, “\\Resource\\People\\VisitingFaculty.txt”); if another variable is not needed. This answer … Read more

HttpListener class with HTTPS support

I did a bunch of homework and got this working. The steps to add SSL support for an .NET HttpListener are: Update C# application code to include the https prefix. Example: String[] prefixes = { “http://*:8089/”,”https://*:8443/” }; That’s it from the code aspect. For the certificate side of things, using the Windows SDK command console … Read more

What is a C# analog of C++ std::pair?

Tuples are available since .NET4.0 and support generics: Tuple<string, int> t = new Tuple<string, int>(“Hello”, 4); In previous versions you can use System.Collections.Generic.KeyValuePair<K, V> or a solution like the following: public class Pair<T, U> { public Pair() { } public Pair(T first, U second) { this.First = first; this.Second = second; } public T First … Read more

C# – Waiting for a copy operation to complete

Yup, use a FileSystemWatcher but instead of watching for the created event, watch for the changed event. After every trigger, try to open the file. Something like this: var watcher = new FileSystemWatcher(path, filter); watcher.Changed += (sender, e) => { FileStream file = null; try { Thread.Sleep(100); // hack for timing issues file = File.Open( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)