我面對的問題是我的目標'CopyBuildFiles'不復制,因爲我認爲它無法找到生成文件夾。 build文件夾是在$(BuildFolder)屬性中定義的,該文件夾名稱是基於date.time創建的,並且是在'CopyBuildFiles'之前運行的之前的一個目標中創建的。MSBuild複製任務問題
如果我硬編碼@(SrcFiles)的路徑,而不是從$(BuildFolder)派生它的工作。
任何想法,這裏發生了什麼以及如何解決這個問題?
非常感謝。
<PropertyGroup>
<year>$([System.DateTime]::Now.ToString("yy"))</year>
<month>$([System.DateTime]::Now.ToString("MM"))</month>
<day>$([System.DateTime]::Now.ToString("dd"))</day>
<time>$([System.DateTime]::Now.ToString("HHmm"))</time>
<AssemblyFileVersionAttribute>[$(year).$(month).$(day).$(time))] </AssemblyFileVersionAttribute>
<BuildFolder>c:\website.builds\$(AssemblyFileVersionAttribute)\</BuildFolder>
<IISFolder>c:\website.publish\</IISFolder>
<LogDirectory>C:\website.builds.logs</LogDirectory>
<LogFile>C:\website.builds.logs\Buildlog_$(AssemblyFileVersionAttribute).txt</LogFile>
</PropertyGroup>
<Target Name="PreBuild">
<MakeDir Directories="$(LogDirectory)" />
<RemoveDir Directories="$(IISFolder)"></RemoveDir>
<MakeDir Directories="$(BuildFolder)" />
<MakeDir Directories="$(IISFolder)" />
</Target>
<Target Name="Compile">
<MSBuild Projects="$(MSBuildStartupDirectory)\websitev2.sln" Properties="OutDir=$(BuildFolder)\" />
</Target>
<ItemGroup>
<SrcFiles Include="$(BuildFolder)_PublishedWebsites\**\*.*"/>
</ItemGroup>
<Target Name="CopyBuildFiles"
Inputs="@(SrcFiles)"
Outputs=
"@(SrcFiles->'$(IISFolder)%(RecursiveDir)%(Filename)%(Extension)')">
<Copy SourceFiles="@(SrcFiles)"
DestinationFiles="@(SrcFiles->'$(IISFolder)%(RecursiveDir)%(Filename)%(Extension)')"
/>
</Target>
<Target Name="Deploy">
<CallTarget Targets="PreBuild" />
<CallTarget Targets="Compile" />
<CallTarget Targets="CopyBuildFiles" />
</Target>
如果運行與命令行的MSBuild「/冗長:診斷」標誌,什麼是輸出說呢? – SuperJumbo