It concerns me that the sample build uses a Post-Build Event to copy the DLL from the Debug directory back up to the main folder. This result should, I believe, alleviate any concerns about naming issues. I can then redo the scenario in VS 2017 where it still works. And I've changed the "command has been added" msg to verify which version is running. I've even verified using Process Explorer that the DLL is in fact loading from the expected location.
Loaded the same project in VS 2019 (ignoring suggestion to update platform and toolset - yes, I've tried it both ways), rebuild, launch Fusion, attach process, set breakpoint, AddIn already added at same folder location - verified by AddIn details, run AddIn (run on startup was not set), breakpoint NOT reached. Loaded the project in VS 2017, rebuild, launch Fusion, attach process, set breakpoint, add AddIn at this new folder location, run AddIn, breakpoint reached, shutdown Fusion.
In reproducing this problem (yet again, N-th iteration) I have copied the SpurGear source (from "CPP\AddInSamples\SpurGear") to a local folder ("H:\SpurGear").
Select the code we want to run and press Ctrl + E + E.In ‘ C# Interactive‘ pane type #r directive with the absolute path to the library.Without the ‘ #r…’ directive we will receive the following error: And we want to run this method in another project, without compiling anything.
net library: #r ""Įxample needed? Here we go! Let’s assume I have a class library ‘ Helpers‘ with a class ‘ Cast‘ and a method ‘ StringToInt()’. That’s even easier when we want to use a. Not a problem, we just use #r directive! For example, for our custom assembly, we just type the following code in the C# Interactive tab : #r "path/MyVeryImportandLib.dll" Ok, but what if I want to run the code that requires some assembly? FileInfo file = new we check the c: drive. Ooook, why don’t we create a text file? Let’s write the following C# code: using Īnd let’s test the lines that create the file so we select the below lines and press Ctrl + E, E. What is going on here? Well, the Roslyn(known as a ‘ Compiler as A Service’) takes your C# code and runs it! Amazing, isn’t it? Show me something usefull! We will see the ‘ C# interactive’ pane activate in the bottom of the Visual Studio window. Press Ctrl + E, E and wait for the magic to happen! Depending on the Visual Studio version, we need to type only class names or the class names with namespaces.Ģ. This has to be a fully compilable fragment so make sure that if you copy the code to the separate project, it would compile. Select the fragment of code we want to run. Ok, so if we want to run just the fragment of our code – this is what we do:ġ.
I can’t be the only person who hates waiting for the code to compile and run… Especially when I want to test only a small part of it! That’s a total waste of time! But good news everyone, I found a way to run a part of my C# code without building the whole project! Ctrl + E, E – the magical shortcut!