Closed professordave closed 3 years ago
I have exactly same problem but cannot find a solution
Thank you. I have been able to replicate this problem, but I don't know the solution.
i tried a single .exe file with opencvsharp3(deprecated version). it worked.
@HaaniCodes
Thanks for the tip!
Going back to opencvsharp3 works for me also!
I also had to make a few code changes to get the code to compile against the older library.
For now it enables me to create a single executable that I can send to users.
@HaaniCodes So I take back that it works. The Executable runs but video capture breaks the application. capture.open() throws exception Unable to load DLL OpenCVSharpExtern
If I copy the file OpenCvSharpExtern.dll
and place it in the same directory as the one file executable the video works.
Is there some way to get this file also inside the single executable?
Any ideas how to proceed?
@HaaniCodes Okay got it working. Mark that DLL as copy always, then the resulting exe works
I have a similar issue using OpenCvSharp4.Windows v4.5.0.20201013
if I publish a single file then OpenCvSharpExtern.pdb is included in the output directory with the executable, which will then only run if I manually copy .pdb to the unpacked temp\.net
directory.
Adding the .pdb to the project explcitly and setting it to always copy to output does not resolve this issue.
Downgrading to v3 works fine for me as a single exe, still be good to get latest working. Might fork and have a poke at it later.
I've got similar issue with .net 5 project. When trying to run single exe app it fails with:
Error:
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'OpenCvSharp4.runtime.win', version: '4.5.0.20201013'
path: 'runtimes/win-x64/native/OpenCvSharpExtern.pdb'
In obj\Release\net5.0\win-x64\MyApp.deps.json in targets -> .NETCoreApp,Version=v5.0/win-x64 I have:
"OpenCvSharp4.runtime.win/4.5.0.20201013": {
"native": {
"runtimes/win-x64/native/OpenCvSharpExtern.dll": {
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/OpenCvSharpExtern.pdb": {
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/opencv_videoio_ffmpeg450_64.dll": {
"fileVersion": "2020.9.0.0"
}
}
}
As a workaround I'm just automatically creating empty file "OpenCvSharpExtern.pdb" in the exe's directory. It works for me.
Question: why the OpenCvSharpExtern.pdb is in deps.json? Is there any better way to fix this without a downgrade?
I've got similar issue with .net 5 project. When trying to run single exe app it fails with:
Error: An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found: package: 'OpenCvSharp4.runtime.win', version: '4.5.0.20201013' path: 'runtimes/win-x64/native/OpenCvSharpExtern.pdb'
In obj\Release\net5.0\win-x64\MyApp.deps.json in targets -> .NETCoreApp,Version=v5.0/win-x64 I have:
"OpenCvSharp4.runtime.win/4.5.0.20201013": { "native": { "runtimes/win-x64/native/OpenCvSharpExtern.dll": { "fileVersion": "0.0.0.0" }, "runtimes/win-x64/native/OpenCvSharpExtern.pdb": { "fileVersion": "0.0.0.0" }, "runtimes/win-x64/native/opencv_videoio_ffmpeg450_64.dll": { "fileVersion": "2020.9.0.0" } } }
As a workaround I'm just automatically creating empty file "OpenCvSharpExtern.pdb" in the exe's directory. It works for me.
Question: why the OpenCvSharpExtern.pdb is in deps.json? Is there any better way to fix this without a downgrade?
Hello, can you provide a little detail and how you are generating the pdb? Thanks!
Hello, can you provide a little detail and how you are generating the pdb? Thanks!
Hi, the project is .net 5.0 web app.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<!--the rest-->
</PropertyGroup>
</Project>
It is published with:
dotnet publish $(ProjectToPublish) --configuration Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:TraceSingleFileBundler=true --output $(FinalOutputDir) --verbosity Normal
After this we have a step in continuous integration build to add the missing OpenCvSharpExtern.pdb.
It's a command line:
@echo off
set requiredFileName=OpenCvSharpExtern.pdb
cd $(FinalOutputDir)
if exist %requiredFileName% (
echo %requiredFileName% already exists
) else (
echo creating empty %requiredFileName%
type NUL > %requiredFileName%
)
type NUL > OpenCvSharpExtern.pdb
creates 0 byte file.
In our usage (which isn't debugging of OpenCvSharpExtern) it works.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Summary of your issue
Single file exe from publish does not run. .net core 3.1 wpf
This is the new publish to single file exe for .net core 3.1
Start with a project in which the single file exe does run. Add in the opencvsharp4 libraries with native binding.
Rebuild single file exe, try running it and now it does not run. When clicking on it the spinning circle does show, but then app never shows
No errors.
App runs fine in debugger or when not in single file exe.
Create a new .net core
Environment
Write your environment.
What did you do when you faced the problem?
Write here
Example code:
Output:
What did you intend to be?