2017-02-17 1171 views
0

我是MSBuild環境的新手,在嘗試構建其中一個應用程序時,我遵循一些說明。通過以下書面申請文檔中的說明,我是能夠建立,它看起來像下面的命令:MSBuild錯誤:MSBUILD:錯誤MSB1009:項目文件不存在

msbuild /t:Harvest;WIX setup.build; /P:publish_location="C:\Installer";product_file="C:\Temp\ServiceHost.dll";product_id="1.0" 

但是當我運行的命令,它會引發以下錯誤:

MSBUILD : error MSB1009: Project file does not exist.

這引發了很多問題:

  1. 在這裏沒有名爲Project的參數。我不確定爲什麼它在特定參數上失敗?
  2. 「/ t:Harvest; WIX」是什麼意思?
  3. 通常情況下,msbuild命令引用.sln或.csproj文件,但我所指的文檔特別希望我引用.Dll文件,所以我這樣做。我對嗎?
  4. 我該如何解決這個錯誤?

只是爲了參考下面就是我所指的文檔:

This solution is only includes an installer. In order to create an MSI with this solution by hand, you need to bring up a visual studio command prompt, navigate to the setup.build location of the Installer project and type the following command: (where the publish location is replaced by the current publish location, product_id is replaced with current product_id, and product_file is the file you want to pull the version from) msbuild /t:Harvest;WIX setup.build /p:publish_location="location";product_file="Matchbox.Management.ServiceHost.dll";product_id="xxxxxxxxxxxx"

+1

wkl的回答很好地描述了每一個msbuild命令是什麼。嘗試將命令更新爲'msbuild/t:Harvest; WIX /p:publish_location="C:\Installer";product_file="C:\Temp\ServiceHost.dll";product_id="1.0「setup.build'確保設置.build位於您運行命令的cmd提示符(或您正在使用的)的工作目錄中。 –

+0

@ CoffeeBean,根據wkl的回答和Brian Sutherland的評論,這個問題呢?您能否讓我知道關於這個問題的最新信息? –

回答

1

MSBuild Command Line Reference

MSBuild.exe [Switches] [ProjectFile] 

所以setup.build是您的項目文件(它似乎無法找到)。

/target:targets

Builds these targets in this project. Use a semicolon or a comma to separate multiple targets, or specify each target separately. /t is also acceptable.

所以

/t:Harvest;WIX 

意味着你正在建設目標Harvest,哪些應該在你的項目文件中定義WIX

/property:name=value

Sets or overrides these project-level properties, where name is the property name and value is the property value. Use a semicolon or a comma to separate multiple properties, or specify each property separately. /p is also acceptable.

所以

/P:publish_location="C:\Installer";product_file="C:\Temp\ServiceHost.dll";product_id="1.0" 

簡單地定義了可用於在您的MSBuild項目的任何目的的三個屬性。所以我們不能分辨你是否正確。但它似乎是根據你的文件。