The situation is as follows: For Visual Studio 2015, a VSIX plugin is being developed. I create an arbitrary project in Visual Studio, for example, dll. After the project build, it should load into the vsix package using the following lines:
byte[] bytes = System.IO.File.ReadAllBytes('fileName.dll'); Assembly assembly = Assembly.Load(bytes); Next, I begin to explore the assembly using reflection. The problem is the following - if you edit the code of an arbitrary project and try to re-do the project build, the following error occurs: 'Cannot open' filename.pdb 'for writing -' The process cannot access the file ' by another process. '
Accordingly, in the Modules window you can see the loaded symbols for 'filename.dll'. It is not clear why the symbols are loaded in Visual Studio and how to avoid it? In principle, it would be possible to create a domain and load dll into it (and then upload), however, this is due to library loading restrictions (a problem may occur if the library has references to other dll - in this case, the library files need to be copied to the application directory + domain interaction problems). This problem can be reproduced as follows:
1) create Vsix package
2) add the default ToolWindow, where in the method that is subscribed to the event of the default button we add lines of code that I gave, after pre-registering the path to the file to be compiled (4)
3) run the experimental instance (or simply install the compiled package)
4) create a project with dll (the path to the output file should be registered in (2)) and add an arbitrary method there
5) if after clicking on the button (2) try to modify the source code of the dll and try to knock off the project again, then it will not work