2011-07-27 45 views
4

msbuild發佈後,TransformWebConfig文件夾爲空。以下是teamcity日誌Msbuild在轉換時未複製web.config文件

[09:31:43]: [CollectWebConfigsToTransform] GetPublishingLocalizedString 
[09:31:43]: [GetPublishingLocalizedString] Found The following for Config tranformation: 
{0} 
[09:31:43]: [it\it.vbproj.teamcity] PipelineTransformPhase 
[09:31:43]: [PipelineTransformPhase] GetPublishingLocalizedString 
[09:31:43]: [GetPublishingLocalizedString] Publish Pipeline Transform Phase 
[09:31:43]: [it\it.vbproj.teamcity] AutoParameterizationWebConfigConnectionStringsCore 
[09:31:43]: [AutoParameterizationWebConfigConnectionStringsCore] Skipping target 
"AutoParameterizationWebConfigConnectionStringsCore" because it has no inputs. 
[09:31:43]: [it\it.vbproj.teamcity] CopyAllFilesToSingleFolderForPackage (1s) 
[09:31:43]: [CopyAllFilesToSingleFolderForPackage] GetPublishingLocalizedString 
[09:31:43]: [GetPublishingLocalizedString] Copying all files to temporary location below for package/publish:obj\Deploy-Dev\Package\PackageTmp. 

Web.config文件存在於目錄中。只是不明白爲什麼它沒有選擇它。另外發布後,目標位置包含web.deploy和web.release文件,而不是web.config文件。請幫忙。

+0

我有一個[類似問題](http://stackoverflow.com/questions/6829692/how-do-i-run-app-config-transformation-task-first-before-the-postbuildevents)與應用程序。配置。我認爲這與{編譯,發佈,轉換}的順序有關 – oleksii

+0

我正在使用以下命令行參數 /M /P:Configuration=%env.Configuration%/ P:DeployOnBuild = True /P:DeployTarget = MSDeployPublish /P:MsDeployServiceUrl=%env.TargetServer%/MsDeployAgentService/P:MSDeployPublishMethod = RemoteAgent/P:CreatePackageOnPublish = True /P:Username=%env.username%/P:Password=%env.password%,他們工作得很好對於其他項目而言,它只是一個項目。 – sam

回答

10

經過幾次解決後,找出web.config屬性設置爲「不要複製」,將其更改爲始終複製,然後將「構建」操作設置爲「無」,將其更改爲內容。希望它能幫助別人。

+0

我右鍵單擊Web.config>屬性,將「Build action」更改爲「Conent」並將「Copy to Direct Direct」更改爲「Copy if newer」 – Stewie

+1

將「Build Action」設置爲Content似乎是此處的關鍵。我不認爲「複製總是」是必需的,因爲它最終會被複制到無關的bin目錄中。 –

+0

對於未來的讀者:這個答案是正確的,但Subhash評論(對這個答案的評論)是一個「更多」正確。感謝這兩個! – granadaCoder