根据平台链接dll's到项目
本文关键字:项目 平台 链接 dll | 更新日期: 2023-09-27 18:16:54
我有一个名为'libs'的文件夹,其中包含dll。主项目(c#)包含这些dll作为链接。我想问一下,当我点击构建时,是否可以将库链接到项目?如何使用pre/post-build事件?我也想根据平台链接这些库。因此,如果我构建调试,我想使用dll的调试版本,当我构建发布版本时,使用发布版本。
谢谢你的帮助
当我点击构建时,是否可以将库链接到项目?如何关于使用pre/post-build事件?我想根据情况把这些资料联系起来也在站台上。所以如果我构建debug,我想使用debug版本的dll,
可以使用msbuild条件来使用不同的dll。请右键单击项目->卸载项目->右键单击项目->编辑xxx。然后在Csproj中添加如下代码:
<Target Name="BeforeBuild">
<Message Text="start $(Platform)" />
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<Content Include="..'Libs'Arm'ClassLibrary1.dll">
<Link>ClassLibrary1.dll</Link>
</Content>
<Content Include="..'Libs'Arm'ClassLibrary2.dll">
<Link>ClassLibrary2.dll</Link>
</Content>
<!-- ... other dlls -->
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<Content Include="..'Libs'Arm'Debug'ClassLibrary1.dll">
<Link>ClassLibrary1.dll</Link>
</Content>
</ItemGroup>
</Target>