Posts

Showing posts with the label Visual Studio

Can't Uninstall/reinstall NuGet Package

Answer : In your Solution or Project you will find a file called packages.config . Open this file and you will see all the packages that NuGet has installed. The file will look something like this: <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Json" version="2.0.3" targetFramework="net45" /> </packages> Simply delete the line of your package and save the file. <?xml version="1.0" encoding="utf-8"?> <packages> </packages> Then run NuGet again and it should install. The JSON.NET NuGet package should just work with a Windows Phone 8.0 project. Adding it in VS2012 NuGet manager pulls in the WP7 version of JSON.NET. (packages\Newtonsoft.Json.4.5.10\lib\sl3-wp\Newtonsoft.Json.dll) JSON.NET is now also available as a Portable Class Library which you can consume from WP8 (available in NuGet or in source form). UPDATE: The latest version of N...

Add A PDF Viewer To A WPF Application

Answer : As already suggested by @NawedNabiZada, one tried and straightforward way is to use embedded InternetExplorer to show Adobe PDF Reader ActiveX control. So it assumes you are running on Windows and have Adobe PDF Reader installed. Then you create a user control, window etc. that contains following control: <WebBrowser x:Name="pdfWebViewer"></WebBrowser> In the constructor navigate to blank page: pdfWebViewer.Navigate(new Uri("about:blank")); To load a PDF document to that control use this simple code: pdfWebViewer.Navigate(fullPathToPDF); This approach is used by many Windows software not only WPF apps including SAP client, but has a hidden problem, see this question. The Adobe PDF Reader Addon in Internet Explorer must be enabled for this to work. There are various problems with Acrobat Reader XI, better to use DC version. To enable Adobe PDF go to IE settings, add-ons and find Adobe PDF Reader and enable it (AR XI and above...

Could Not Load File Or Assembly, PublicKeyToken=null

Image
Answer : This error usually means that the assembly was not found. Try verifying that the file exists in the directory where your application is running. If you still can't figure out which file fails loading, try using a tool such as Fusion Log Viewer (run fuslogvw.exe from the Visual Studio command prompt), to determine which files the CLR was trying to load and from where, so that you can see exactly what failed. I experienced the same problem, and the reason was that I compiled my EXE and DLL on 32 bit machine for "x86", because it depends on C++\CLI library compiled for Win32. Then I tried to use this library on 64 bit machine from 64 bit process. Obviously 64 bit process can't load 32 bit libraries, so I got this error, which does not really help to understand the problem. So the reason could be that you try to use 32 bit library from 64 bit process. Building over nogard answer, try setting the Solution Platform to x86

Alphabetizing Methods In Visual Studio

Answer : While Resharper has many cool features it has a large impact in CPU and I/O usage and can be very complicated to use. It is also only available under commercial licensing unless you qualify for a few very specific free use licenses. Try CodeMaid. It is free for commercial use and has a much lower performance overhead. I find it easy to use and it is very good for alphabetizing methods. To sort your file, open the file via solution explorer: Right click the open file Code Maid menu (likely near the top of the right click menu) Click Reorganize Active Document Alternatively, using the default CodeMaid hotkeys CTRL + M , Z to sort your active file. Resharper has a Type Members Layout, which can order members by type, accessibility and alphabetically as well. You can also take a look into Ora , which presents a pane in visual studio that is ordered (even though your source may not be). Link's dead. The following answer goes much further than the OP asks,...

Could Not Load File Or Assembly System.Runtime.CompilerServices.Unsafe

Answer : Could not load file or assembly System.Runtime.CompilerServices.Unsafe It seems that you have installed System.Runtime.CompilerServices.Unsafe nuget package 4.5.3 version. And it corresponds to System.Runtime.CompilerServices.Unsafe.dll assembly version 4.0.4.1 . Suggestion 1) Please try to register System.Runtime.CompilerServices.Unsafe version 4.0.4.1 into GAC so that the system can it. Run Developer Command Prompt for VS2019 as Administrator type: cd xxxxx (the path of the the System.Runtime.CompilerServices.Unsafe 4.0.4.1) gacutil /i System.Runtime.CompilerServices.Unsafe.dll 2) If you use Net Framework projects with xxx.config file, you could use bindingRedirect. Add these in app.config file or web.config file: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" ...

Can I Profile NodeJS Applications Using Visual Studio Code?

Image
Answer : There is no plugin/support that I am aware of for initiating the profiling, or heap dumps, etc that are available in Chrome's Dev Tools. But, the VS Code debugger can work alongside the dev tools debugger. Start from VS Code, and start debugging as you would. Then open dev tools from any tab in the Chrome/Chromium browser, and look for the green icon indicating a node.js debugging process is running ( manually done via node --inspect ): . Click this green icon and you'll have many of the browser dev tools features for debugging the node.js process, specifically the memory and profiler tabs. Visual Studio Code 1.45 (April 2020) should help, as it integrates Javascript debugging capabilities, including profiling: New JavaScript debugger This month we've continued making progress on our new JavaScript debugger. It's installed by default on Insiders, and can be installed from the Marketplace in VS Code Stable. You can start using it with your e...

Can I Hex Edit A File In Visual Studio?

Answer : Menu File → Open → File Select the file to be opened On the open file dialog at the bottom there is a down arrow on the "Open" button Click "Open With..." Click "Binary Editor" Click OK Or for the keyboard geeks out there: Ctrl + o Ctrl + v (paste filename) tab tab ↓ w b Enter In addition to Kevin's answer, with Visual Studio 2017 you need to have the Visual Studio C++ Core Features component installed. Source

Could Not Load File Or Assembly 'System.Buffers, Version=4.0.2.0...'

Answer : Could not load file or assembly 'System.Buffers, Version=4.0.2.0…' Solution 1) use CMD(run as Administrator ) and type cd xxxx(xxxx\packages\System.Buffers.4.5.1\lib\netstandard2.0)) run gacutil /i System.Buffers.dll Then , when you finish it, please run update-package -reinstall under package manager console to reinstall the package. 2) you can try to change Version=4.0.2.0 to Version=4.0.3.0 in csproj file. Besides , there is a similar issue you can refer to.