gpt4 book ai didi

visual-studio-2010 - 在 Visual Studio 2010 中访问运行时库属性

转载 作者:行者123 更新时间:2023-12-02 21:45:52 24 4
gpt4 key购买 nike

这基本上是一个后续问题: Using Visual Studio project properties effectively for multiple projects and configurations

我们库的目标名称目前采用以下格式:

$(ProjectName)-$(PlatformToolset)-$(PlatformShortName)-$(Configuration)

我们想将有关项目使用的运行时库的信息添加到目标名称中,我尝试添加 $(RuntimeLibrary),但似乎没有设置。有没有其他方法可以在解析目标名称时获取运行时库?

谢谢,约翰。

最佳答案

通过此属性表,您可以做到这一点。将其导入属性表中,您将能够通过以下方式访问 RuntimeLibrary:$(RuntimeLibrary)

是的!!!这将在您的属性表中起作用 =^.~=

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_IsDebug>$([System.Convert]::ToString($([System.Text.RegularExpressions.Regex]::IsMatch($(Configuration),'[Dd]ebug'))))</_IsDebug>

<_ItemDefinitionGroupRegex><![CDATA[<ItemDefinitionGroup Condition=".*']]>$(Configuration)\|$(Platform)<![CDATA['">((?:.*\n)*?.*)</ItemDefinitionGroup>]]></_ItemDefinitionGroupRegex>
<_RuntimeLibraryRegex><![CDATA[(?:.*\n)*?.*<RuntimeLibrary>(.*)</RuntimeLibrary>(?:.*\n)*?.*]]></_RuntimeLibraryRegex>

<_HasRuntimeLibrary>$([System.Text.RegularExpressions.Regex]::IsMatch($([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText($(ProjectPath))), $(_ItemDefinitionGroupRegex)).Result('$1')), $(_RuntimeLibraryRegex)))</_HasRuntimeLibrary>

<!--
Fix incremental build (Different results when running msbuild within Visual Studio or from console).
http://connect.microsoft.com/VisualStudio/feedback/details/677499/different-results-when-running-msbuild-within-visual-studio-or-from-console
-->
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup>

<Choose>
<When Condition="$([System.Convert]::ToBoolean($(_HasRuntimeLibrary)))">
<!-- Extract runtime library from project file. -->
<PropertyGroup Label="UserMacros">
<_RuntimeLibrary>$([System.Text.RegularExpressions.Regex]::Match($([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText($(ProjectPath))), $(_ItemDefinitionGroupRegex)).Result('$1')), $(_RuntimeLibraryRegex)).Result('$1'))</_RuntimeLibrary>
</PropertyGroup>
</When>
<Otherwise>
<!-- Set default runtime library -->
<PropertyGroup Label="UserMacros">
<_RuntimeLibrary Condition=" '$(_IsDebug)' == 'True' ">MultiThreadedDebugDLL</_RuntimeLibrary>
<_RuntimeLibrary Condition=" '$(_IsDebug)' == 'False' ">MultiThreadedDLL</_RuntimeLibrary>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup Label="UserMacros">
<IsDebug>$(_IsDebug)</IsDebug>

<ConfigType Condition=" '$(IsDebug)' == 'True' ">Debug</ConfigType>
<ConfigType Condition=" '$(IsDebug)' == 'False' ">Release</ConfigType>

<Architecture Condition=" '$(Platform)' == 'Win32' ">x86</Architecture>
<Architecture Condition=" '$(Platform)' == 'x64' ">x64</Architecture>

<Toolset Condition=" '$(PlatformToolset)' == 'v110' ">msvc.110</Toolset>

<RuntimeLibrary>$(_RuntimeLibrary)</RuntimeLibrary>
</PropertyGroup>

<ItemGroup>
<BuildMacro Include="IsDebug">
<Value>$(IsDebug)</Value>
</BuildMacro>
<BuildMacro Include="Toolset">
<Value>$(Toolset)</Value>
</BuildMacro>
<BuildMacro Include="Architecture">
<Value>$(Architecture)</Value>
</BuildMacro>
<BuildMacro Include="RuntimeLibrary">
<Value>$(RuntimeLibrary)</Value>
</BuildMacro>
<BuildMacro Include="ConfigType">
<Value>$(ConfigType)</Value>
</BuildMacro>
</ItemGroup>
</Project>

关于visual-studio-2010 - 在 Visual Studio 2010 中访问运行时库属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7800555/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com