大佬教程收集整理的这篇文章主要介绍了Visual Studio 在发布时将 .dll 复制到 Bin 文件夹,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_1@我有以下问题。
我创建了一个 @H_502_1@Azure 函数,并且想要运行存储在 {ProjectfilE}/AlCompiler
文件夹中的编译器。
该文件夹包含@H_502_1@.dll 和@H_502_1@alc.exe 文件。 exe 文件需要这些 @H_502_1@.dll 的 才能运行,否则会产生错误。
我尝试将@H_502_1@AlCompiler文件夹的文件发布到@H_502_1@wwwroot目录在.csproj项目文件中添加以下内容:
<ItemGroup>
<Content Include="AlCompiler/**">
<copyToOutputDirectory>PreserveNeWest</copyToOutputDirectory>
</Content>
</ItemGroup>
我也试过这个标记:
<ItemGroup>
<ContentWithTargetPath Include="AlCompiler/**">
<copytopublishDirectory>PreserveNeWest</copytopublishDirectory>
<TargetPath>AlCompiler\%(fileName)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
并尝试使用 <link>
属性:
<ItemGroup>
<Content Include="AlCompiler/**">
<copytopublishDirectory>PreserveNeWest</copytopublishDirectory>
<link>AlCompiler\%(fileName)%(Extension)</link>
</Content>
</ItemGroup>
@H_502_1@所有这些都会导致 AlCompiler 目录的文件在发布时被拆分:
我没有找到任何方法将它们放在一个地方。
@H_502_1@所以我无法运行 alc.exe 文件,因为缺少 .dll。
我很高兴能得到您的帮助!
您应该在 .csproj
中使用以下代码。
<ItemGroup>
<ResolvedFileToPublish Include="your_folder/yourfile">
<RelativePath>your_folder/yourfile</RelativePath>
</ResolvedFileToPublish>
<ResolvedFileToPublish Include="azure-functions-host/appsetTings.prod.json">
<RelativePath>azure-functions-host/appsetTings.prod.json</RelativePath>
</ResolvedFileToPublish>
<ResolvedFileToPublish Include="azure-functions-host/appsetTings.dev.json">
<RelativePath>azure-functions-host/appsetTings.dev.json</RelativePath>
</ResolvedFileToPublish>
</ItemGroup>
有关更多详细信息,您可以在下面的帖子中看到我的回答。@H_489_61@
1. Azure Functions don't publish appsetTings.prod.json file
2. Unable to find files located in my root project folder when hosted on Azure
,我遇到了解决方案,反之亦然。
我没有尝试将 .dll's@H_489_61@ 添加到 Compiler 文件夹(存储 .exe@H_489_61@ 的位置),而是将 .exe's@H_489_61@ 添加到 bin 文件夹( .dll 的@H_489_61@ 存储在哪里)。
不知道这是否是最好的解决方案,但它有效:
<ItemGroup>
<ContentWithTargetPath Include="AlCompiler/**">
<CopyToOutputDirectory>PreserveNeWest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNeWest</CopyToPublishDirectory>
<TargetPath>bin\AlCompiler\%(RecursiveDir)%(FileName)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
以上是大佬教程为你收集整理的Visual Studio 在发布时将 .dll 复制到 Bin 文件夹全部内容,希望文章能够帮你解决Visual Studio 在发布时将 .dll 复制到 Bin 文件夹所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。