2011-11-19 54 views
2

我創建了以下簡單的msbuild項目文件,但輸出很奇怪(請參閱消息標記結果)。MSBuild不識別/理解屬性

<?xml version="1.0" encoding="utf-8"?> 
<Project DefaultTargets="Upload" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <DirectoryToUpload>Directory\</DirectoryToUpload> 
    <RemoteServer>my.remote.server.com</RemoteServer> 
    </PropertyGroup> 
    <Target Name="Upload"> 
    <Message Text="Uploading from directory ${DirectoryToUpload} to server ${RemoteServer}" /> 
    </Target> 
</Project> 

並輸出。

D:\Project\Source>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe ftpupload.proj /target:Upload 
Microsoft (R) Build Engine Version 4.0.30319.1 
[Microsoft .NET Framework, Version 4.0.30319.239] 
Copyright (C) Microsoft Corporation 2007. All rights reserved. 

Build started 11/19/2011 4:22:28 PM. 
Project "D:\Project\Source\ftpupload.proj" on node 1 (Upload target(s)). 
Upload: 
    Uploading from directory ${DirectoryToUpload} to server ${RemoteServer} 
Done Building Project "D:\Project\Source\ftpupload.proj" (Upload target(s)). 

爲什麼MSbuild顯示屬性名稱,但不是它的值?

P.S.整個事情在TeamCity下運行,但是誰啓動msbuild.exe沒有區別,結果總是一樣的。

回答

4

該屬性語法不正確。正確的語法應該帶括號:

<?xml version="1.0" encoding="utf-8"?> 
<Project DefaultTargets="Upload" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <DirectoryToUpload>Directory\</DirectoryToUpload> 
    <RemoteServer>my.remote.server.com</RemoteServer> 
    </PropertyGroup> 
    <Target Name="Upload"> 
    <Message Text="Uploading from directory $(DirectoryToUpload) to server $(RemoteServer)" /> 
    </Target> 
</Project> 
+0

我是一個完整的IDIOT! –

+1

@Vasiliy - 不,只是犯了一個錯誤。 –

+0

@VasiliyBorovyak:我已經追蹤了幾個小時甚至前一天的事情。好時光,呃? –