2012-02-26 27 views
7

我們有一個Asp.Net網絡應用程序,我們試圖將其僞裝到一個文件夾中,我開始認爲微軟是瘋狂的 - 爲什麼很難讓WAP做一個「本地文件系統「部署爲MSBuild的一部分?無法msdeploy網站包到臨時文件夾?

我可以用這個建:

msbuild .\SubSite.csproj "/p:Platform=AnyCPU;Configuration=Release" /t:Package 

,並得到一個不錯的package.zip,我可以部署到網站...

不過,我有兩個項目在我的解決方案,這是我在我運送它們之前需要合併,所以我想將兩個軟件包都部署到一個文件夾中,然後重新打包該文件夾。儘管documentation TechNet上to the contrary,這似乎並不可能做到:

msdeploy -verb:sync -source:package=.\SubSite.zip -dest:contentPath=.\Www\SubSite 

因爲你的錯誤:

Source (sitemanifest) and destination (contentPath) are not compatible for the given operation.

任何人不會有我如何能網絡部署兩個建議不需要手動將文件從「PackageTmp」文件夾中複製出來即可我的意思是,我知道我只需要skip zipping the package and manually copy the files out就可以做到這一點,但我不必爲創建自定義目標而感到高興,並且沒有其他方法可以找到適合自己的應用。

+1

事實上,這裏的答案(即使是「這是不可能的」)會很好。 – 2012-03-23 20:23:27

回答

1

我們最終弄清楚瞭如何做到這一點,但我並不是真的很高興;-)

基本上(如上所述的其他地方),您可以調用msbuild並將目標設置爲_WPPCopyWebApplication。當您這樣做時,您還可以指定/覆蓋WebProjectOutputDir屬性。就像這樣(其中$ {name}是我們正在使用的變量)

msbuild ${SourcePath}\Www\UI\UI.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=${OutputPath}\AppRoot" "/t:_WPPCopyWebApplication" 
msbuild ${SourcePath}\Www\Mobile\Mobile.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=${OutputPath}\AppRoot\Mobile" "/t:_WPPCopyWebApplication" 
msbuild ${SourcePath}\Www\Service\WebService.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=${OutputPath}\AppRoot\WebServices" "/t:_WPPCopyWebApplication" 

然後我們可以在一個單獨的步驟中打包整個「AppRoot」。

相關問題