1
votes

I just want to use msbuild command line option to relink a project. The default option is /t:build. When I change it to /t:link , the error is MSB4057: The target "link" does not exist in the project How can I enable linking for this solution ? [echo] msbuild /nologo /m /p:Configuration=" Release" /p:Platform="W in32" /p:VisualStudioVersion="11.0" /t:link "../../XYZ.sln "

2
@granadaCoder is right in general. For a .vcxproj, this might help A guide to .vcxproj and .props file structure.Tom Blodget

2 Answers

0
votes

I think you're missing what the /t parameters is for.

In the below msbuild definition.

I can call any of these:

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

or I can call no target, which will run "AllTargetsWrapped" because it is the default target.

Do you have a

    <Target Name="link">

in your code?

Below is the sample .proj definition to which I refer to above in my examples.

<?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>