I have a set of sql scripts set as BuildAction=embedded resources and CopyToOutDirectory=CopyAlways.
It does not seem to copy to the bin directory.
I must have them as EmbeddedResources and not content.
Is there a way to do it?
EmbeddedResources are, as the name already suggests, "embedded" in the assembly, so they are not copied to the output directory anymore.
If you need it "both ways" you could use a post-build task like the following:
xcopy $(ProjectDir)\MyFile.ext $(TargetDir)\
but you would need to maintain this script if you add/remove files you need copied.
Also keep in mind, that if you change that file in the output directory the embedded resource you are using in your program is NOT changed.
You can can use "Link" metadata to set your destination folder
For Example: Use this to copy a.dll to "bin" folder
<EmbeddedResource Include="Resources\a.dll" Link="..\bin\a.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
for more reference visit : https://github.com/Microsoft/msbuild/issues/2795