从DLL到自己的Import Library的依赖,如何避免?

时间:2011-11-14 09:38:46

标签: visual-studio visual-studio-2010 dll msbuild

我正在从IDL文件构建代理/存根库,由于某种原因,构建驱动程序认为链接期间生成的导入库是链接的输入文件,导致项目每次都重新链接(路径名缩短以便于阅读):

10:05:33.764 1>
Target "Link: (TargetId:66)" in file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets" from project "[...]\VersionControl.vcxproj" (target "_Link" depends on it):
Using "Link" task from assembly "Microsoft.Build.CppTasks.Win32, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Link" (TaskId:26)
    Write Tracking Logs: (TaskId:26)
[...]
    Outputs for [...]\DEBUG\DLLDATA.OBJ|[...]\DEBUG\VERSIONCONTROL.DLL.EMBED.MANIFEST.RES|[...]\DEBUG\VERSIONCONTROL_I.OBJ|[...]\DEBUG\VERSIONCONTROL_P.OBJ: (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.ILK (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.DLL (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.DLL.INTERMEDIATE.MANIFEST (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.PDB (TaskId:26)
    Inputs for [...]\DEBUG\DLLDATA.OBJ|[...]\DEBUG\VERSIONCONTROL.DLL.EMBED.MANIFEST.RES|[...]\DEBUG\VERSIONCONTROL_I.OBJ|[...]\DEBUG\VERSIONCONTROL_P.OBJ: (TaskId:26)
    [...]\LIB\RPCRT4.LIB (TaskId:26)
    [...]\LIB\KERNEL32.LIB (TaskId:26)
    [...]\LIB\USER32.LIB (TaskId:26)
    [...]\LIB\GDI32.LIB (TaskId:26)
    [...]\LIB\WINSPOOL.LIB (TaskId:26)
    [...]\LIB\COMDLG32.LIB (TaskId:26)
    [...]\LIB\ADVAPI32.LIB (TaskId:26)
    [...]\LIB\SHELL32.LIB (TaskId:26)
    [...]\LIB\OLE32.LIB (TaskId:26)
    [...]\LIB\OLEAUT32.LIB (TaskId:26)
    [...]\LIB\UUID.LIB (TaskId:26)
    [...]\LIB\ODBC32.LIB (TaskId:26)
    [...]\LIB\ODBCCP32.LIB (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.DLL.EMBED.MANIFEST.RES (TaskId:26)
    [...]\DEBUG\DLLDATA.OBJ (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL_I.OBJ (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL_P.OBJ (TaskId:26)
    [...]\SYSTEM32\TZRES.DLL (TaskId:26)
    [...]\SORTING\SORTDEFAULT.NLS (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.EXP (TaskId:26)
    [...]\DEBUG\VERSIONCONTROL.LIB (TaskId:26)
    [...]\VERSIONCONTROL.DEF (TaskId:26)
    [...]\LIB\MSVCRTD.LIB (TaskId:26)
    [...]\LIB\OLDNAMES.LIB (TaskId:26)
    Source compilation required: input [...]\DEBUG\VERSIONCONTROL.LIB is newer than output [...]\DEBUG\VERSIONCONTROL.DLL. (TaskId:26)

项目设置为普通DLL项目,默认设置为左侧。知道为什么MSBuild决定将这些生成的文件视为输入,以及我如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

这是在黑暗中拍摄的,但值得一看......

打开vcxproj文件并查找@(Midl)项。通过尝试这三个项目元数据中的一个来修改它,看看行为如何变化,它可能会让你走在正确的道路上:

  <Midl Include="My.idl">
    <LinkCompiled>false</LinkCompiled>
    <LibCompiled>false</LibCompiled>
    <ImpLibCompiled>false</ImpLibCompiled>
  </Midl>