interactive icon indicating copy to clipboard operation
interactive copied to clipboard

can't load local dll when #!pwsh dotnet build csproj

Open nczsl opened this issue 3 years ago • 7 comments

Describe the bug

Please provide as much information as you can.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

  • OS
    • [ ] Windows 11
    • [ x] Windows 10
    • [ ] macOS
    • [ ] Linux (Please specify distro)
    • [ ] iOS
    • [ ] Android
  • Browser
    • [ x] Chrome
    • [ x] Edge
    • [ ] Firefox
    • [ ] Safari
  • Frontend
    • [ ] Jupyter Notebook
    • [ ] Jupyter Lab
    • [ ] nteract
    • [ x] Visual Studio Code
    • [ ] Visual Studio Code Insiders
    • [ ] Visual Studio
    • [ ] Other (please specify)

Screenshots

If applicable, add screenshots to help explain your problem.

my needs is research local csproj ,so need load local dll by #r command into net interactive notebooks. but when i use #!pwsh dotnet build xxx.csproj after sucessed this process and then i use #r xxx.dll , first is can, but is update source code changed some place, and redo this process, will recived error, at the #!pwsh command excute time, the error message is: "Files\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(4632,5): warning MSB3026: 无法将“obj\Debug\net6.0\Synario.Util.dll”复制到“bin\Debug\net6.0\Synario.Util.dll”。1000 毫秒后将开始第 1 次重试。The process cannot access the file" ... And repeated this error message many times

nczsl avatar Oct 13 '22 18:10 nczsl

Could you provide a more detailed way to reproduce the issue, e.g. an example notebook?

Based on the way the error message begins, it looks like there might be a path that needs to be quoted, that was broken in two by the space in Program Files.

jonsequitur avatar Oct 13 '22 18:10 jonsequitur

if not use '#!pwsh dotnet build xxx.dll'command in 'net interactive notebooks' but use dotnet build xxx.dll in vscode pwsh terminal,the problem is still appear, when at least second time after update source code, change some place in the source code. at pwsh terminal and use command 'dotnet ... xxx.dll' then appear this problem,

nczsl avatar Oct 13 '22 18:10 nczsl

I try to reproduce the error process as follows: 1,create or open some *.ipynb file in vscode use '.net interactive notbooks' plugin 2, #r "local_xxx.dll" // this dll is local machine not from nuget source,ok. 3, use some test sentence like is "xx.some_property" and press key : ctrl+enter ,then show correct results! 4, find the xxx.dll source code ,change some place ,for example , change property name from xx.some_property update to xx.some_property111, and save and excute command 'dotnet build ... xxx.dll' in vscode terminal , and this time will recived many time wram message say meanings'.... File locked by ". NET Host (14556)" ...'

nczsl avatar Oct 13 '22 19:10 nczsl

It sounds like the dotnet-interactive process is holding onto the .dll and preventing the build from overwriting it. In VS Code, if you restart the kernel, it should allow you to rebuild the project. You can do this by opening the command palette and running the command .NET Interactive: Restart the current notebook's kernel. You'll need to rerun the notebook cells afterward.

image

jonsequitur avatar Oct 14 '22 14:10 jonsequitur

yes, but not very easy to use.

nczsl avatar Oct 14 '22 15:10 nczsl

Is restarting the Kernel between every update the way to go when developing extensions? In that case, are there any ways to restart the kernel programatically from a cell?

Dzeneralen avatar Nov 01 '23 19:11 Dzeneralen

There's no way to programmatically restart the kernel.

jonsequitur avatar Nov 06 '23 20:11 jonsequitur