SolutionDir set to *Undefined* in post-build xcopy event

前端 未结 3 2148
借酒劲吻你
借酒劲吻你 2021-02-20 06:32

I have a project that has a post-build event that xcopies a DLLs to a certain directory:

xcopy \"$(TargetDir)$(TargetName).dll\" \"$(SolutionDir)..\\UdpLocationS         


        
相关标签:
3条回答
  • 2021-02-20 06:46

    I just ran into the same problem with TeamCity.

    The issue here is the $(SolutionDir) property in your build file. You haven't defined it in your call to MsBuild (this is why you see the word undefined in your output).

    Call msbuild with the property set, like this:

    msbuild myproject.csproj /property:SolutionDir="solution directory"\
    

    Where "solution directory" is the directory containing your solution file. Note the trailing slash, you'll need that to make sure the path is correctly formed.

    0 讨论(0)
  • 2021-02-20 06:52

    Follow these steps:

    • Unload your project file (e.g. *.csproj)
    • Open your project file for editing
    • Find the AfterBuild target
    • Separate out the two invocations of XCopy into two distinct Exec tasks
    • Save your changes and Reload your project file
    0 讨论(0)
  • 2021-02-20 07:01

    I fixed this for problems with the Microsoft.SqlServer.Compact nuget package (which adds a similar post-build script), by adding:

    <SolutionDir Condition="'$(SolutionDir)'=='' or '$(SolutionDir)'=='*Undefined*'">..\</SolutionDir>
    

    right above the <PostBuildEvent>. You'll want to adjust the relative path to match your project layout.

    0 讨论(0)
提交回复
热议问题