1

我只想使用 msbuild 命令行选项重新链接项目。默认选项是 /t:build。当我将其更改为 /t:link 时,错误为 MSB4057:项目中不存在目标“链接”如何启用此解决方案的链接?[回声] msbuild /nologo /m /p:Configuration="Release" /p:Platform="W in32" /p:VisualStudioVersion="11.0" /t:link "../../XYZ.sln"

4

2 回答 2

0

我认为您缺少 /t 参数的用途。

在下面的 msbuild 定义中。

我可以调用其中任何一个:

/t:AllTargetsWrapped
/t:CleanArtifactFolder
/t:BuildItUp
/t:CopyFilesToArtifactFolder
/t:RenameConfigurationFiles

或者我可以不调用任何目标,它将运行“AllTargetsWrapped”,因为它是默认目标。

你有没有

    <Target Name="link">

在你的代码中?

下面是我在上面的示例中引用的示例 .proj 定义。

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="AllTargetsWrapped">

    <PropertyGroup>
        <!-- Always declare some kind of "base directory" and then work off of that in the majority of cases  -->
        <WorkingCheckout>.</WorkingCheckout>
    </PropertyGroup>

    <Target Name="AllTargetsWrapped">

        <CallTarget Targets="CleanArtifactFolder" />
        <CallTarget Targets="BuildItUp" />
        <CallTarget Targets="CopyFilesToArtifactFolder" />
        <CallTarget Targets="RenameConfigurationFiles" />
    </Target>

    <Target Name="CleanArtifactFolder"> 
        <Message Text="CleanArtifactFolder was called" />
    </Target>

    <Target Name="BuildItUp">   
        <Message Text="BuildItUp was called" />
    </Target>

    <Target Name="CopyFilesToArtifactFolder">   
        <Message Text="CopyFilesToArtifactFolder was called" />
    </Target>

    <Target Name="RenameConfigurationFiles">    
        <Message Text="RenameConfigurationFiles was called" />
    </Target>

</Project>
于 2013-11-13T13:29:28.993 回答
0

您可以使用BuildLink目标

于 2013-11-13T14:05:11.837 回答