What we want to do
- I want to move the dylib in the resources directory to the output directory at build time.
The problem I am having
- The resoucres directory is copied to the output directory, but the dylib cannot be found and executed because the directory structure is not correct.
Steps to reproduce
the directory structure of the project:
- src directory contains the C# source code
- resources directory contains the files that we want copied to the output directory. The directory structure in these files should be retained.
.
├── README.txt
├── Project.csproj
├── Project.sln
├── resources
│ ├── README.txt
│ ├── VERSION
│ ├── libonnxruntime.1.13.1.dylib
│ ├── libonnxruntime.1.14.0.dylib
│ ├── libvoicevox_core.dylib
│ ├── model
│ │ ├── predict_duration-0.onnx
...
│ │ ├── predict_duration-1.onnx
│ │ ├── predict_intonation-0.onnx
│ │ └── predict_intonation-1.onnx
│ ├── open_jtalk_dic_utf_8-1.11
│ │ ├── COPYING
│ │ ├── char.bin
│ │ ├── left-id.def
│ │ ├── matrix.bin
│ │ ├── pos-id.def
│ │ ├── rewrite.def
│ │ ├── right-id.def
│ │ ├── sys.dic
│ │ └── unk.dic
│ └── voicevox_core.h
└── src
...
├── Program.cs
Regarding csprj
ItemGroup
is used to copy to the output directory.- I think it is not working correctly because of the wrong way to set this up. Project.csprj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Include="$(ProjectDir)\resources\**" Exclude="$(ProjectDir)\resources\.gitkeep" CopyToOutputDirectory="Always" Visible="false" />
</ItemGroup>
</Project>
direcotry structure
output dirctory structure
- The resources directory is created in the output directory.
- What I am looking for is for the contents of the resources directory to be generated in the output directory.
bin
└── Debug
└── net7.0
├── Project
├── Project.deps.json
├── Project.dll
├── Project.pdb
├── Project.runtimeconfig.json
└── resources
├── README.txt
├── VERSION
├── libonnxruntime.1.13.1.dylib
├── libonnxruntime.1.14.0.dylib
├── libvoicevox_core.dylib
├── model
│ ├── predict_duration-0.onnx
...
│ ├── predict_duration-1.onnx
│ ├── predict_intonation-0.onnx
│ └── predict_intonation-1.onnx
├── open_jtalk_dic_utf_8-1.11
│ ├── COPYING
│ ├── char.bin
│ ├── left-id.def
│ ├── matrix.bin
│ ├── pos-id.def
│ ├── rewrite.def
│ ├── right-id.def
│ ├── sys.dic
│ └── unk.dic
└── voicevox_core.h
Expected Directory Structures
Here is the directory structure I am looking for, with the contents of the resources directory copied into the output directory.
└── Debug
└── net7.0
├── README.txt
├── VERSION
├── Project
├── Project.deps.json
├── Project.dll
├── Project.pdb
├── Project.runtimeconfig.json
├── libonnxruntime.1.13.1.dylib
├── libonnxruntime.1.14.0.dylib
├── libvoicevox_core.dylib
├── model
│ ├── predict_duration-0.onnx
...
│ ├── predict_duration-1.onnx
│ ├── predict_intonation-0.onnx
│ └── predict_intonation-1.onnx
├── open_jtalk_dic_utf_8-1.11
│ ├── COPYING
│ ├── char.bin
│ ├── left-id.def
│ ├── matrix.bin
│ ├── pos-id.def
│ ├── rewrite.def
│ ├── right-id.def
│ ├── sys.dic
│ └── unk.dic
└── voicevox_core.h
Not sure why, but how it can be resolved.
- Move
resources
directory to the parent directory and update csprj directory tree is this
├── Project
│ ├── README.txt
│ ├── Project.csproj
│ ├── Project.sln
│ └── src
│ ├── Program.cs
...
└── resources
├── README.txt
├── VERSION
├── libonnxruntime.1.13.1.dylib
├── libonnxruntime.1.14.0.dylib
├── libvoicevox_core.dylib
├── model
│ ├── predict_duration-0.onnx
...
│ ├── predict_duration-1.onnx
│ ├── predict_intonation-0.onnx
│ └── predict_intonation-1.onnx
├── open_jtalk_dic_utf_8-1.11
│ ├── COPYING
│ ├── char.bin
│ ├── left-id.def
│ ├── matrix.bin
│ ├── pos-id.def
│ ├── rewrite.def
│ ├── right-id.def
│ ├── sys.dic
│ └── unk.dic
└── voicevox_core.h