[英]Web.config change in asp.net web form in different build in visual studio 2013
[英]Build ASP.Net Website with MSBuild is different from Visual Studio build
我有一個舊的 ASP.Net 網站解決方案,看起來像:
當我在 Visual Studio 中構建解決方案時,我得到以下 output:
------ Build started: Project: C:\...\XXXX\, Configuration: Debug Any CPU ------
Validating Web Site
Building directory '/XXXX/App_Code/'.
Building directory '/XXXX/App_WebReference/'.
Building directory '/XXXX/js/'.
Building directory '/XXXX/msg/'.
Building directory '/XXXX/z_admin/'.
Building directory '/XXXX/z_emulationDialogs/'.
Building directory '/XXXX/'.
但是,當我使用 TFS(MSBuild 任務)構建它或使用解決方案運行msbuild.exe
時,我得到了另一個 output:
Project "C:\TFSAgent\Agent01\_work\1\s\XXXX\XXXX.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "debug|any cpu".
Project "C:\TFSAgent\Agent01\_work\1\s\XXXX\XXXX.sln" (1) is building "C:\TFSAgent\Agent01\_work\1\s\XXXX\XXXX.metaproj" (2) on node 1 (default targets).
Build:
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\BarcodePrinter.dll" to "..\XXXX\\Bin\BarcodePrinter.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\IDAutomation.LinearBarCode.dll" to "..\XXXX\\Bin\IDAutomation.LinearBarCode.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\zxing.dll" to "..\XXXX\\Bin\zxing.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\BarcodePrinter.pdb" to "..\XXXX\\Bin\BarcodePrinter.pdb".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\zxing.pdb" to "..\XXXX\\Bin\zxing.pdb".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\zxing.xml" to "..\XXXX\\Bin\zxing.xml".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Net.Http.dll" to "..\XXXX\\Bin\System.Net.Http.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Net.Http.xml" to "..\XXXX\\Bin\System.Net.Http.xml".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Net.Http.Formatting.dll" to "..\XXXX\\Bin\System.Net.Http.Formatting.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Net.Http.Formatting.xml" to "..\XXXX\\Bin\System.Net.Http.Formatting.xml".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Net.Http.WebRequest.dll" to "..\XXXX\\Bin\System.Net.Http.WebRequest.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Net.Http.WebRequest.xml" to "..\XXXX\\Bin\System.Net.Http.WebRequest.xml".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Web.Http.dll" to "..\XXXX\\Bin\System.Web.Http.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Web.Http.xml" to "..\XXXX\\Bin\System.Web.Http.xml".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Web.Http.WebHost.dll" to "..\XXXX\\Bin\System.Web.Http.WebHost.dll".
Copying file from "C:\TFSAgent\Agent01\_work\1\s\XXXX\bin\System.Web.Http.WebHost.xml" to "..\XXXX\\Bin\System.Web.Http.WebHost.xml".
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe -v /XXXX -p ..\XXXX\ -u -f -d PrecompiledWeb\XXXX\
這個構建后我沒有得到所有 DLL 的問題,如果我在 VS 中publish
,我得到了很多我在 TFS/MSBuild 構建后沒有得到的 DLL(例如App_Code.dll
)。
我試圖添加/p:DeployOnBuild=true
但沒有解決它。
那么如何構建這個項目並准備發布呢?
這是預期的行為。 因為您正在嘗試使用 MSBuild 命令來構建網站項目(metaproj)。 然后它創建一個 PrecompiledWeb 文件夾並將代碼放在那里。
在 Visual Studio 中創建發布配置文件后,將創建以下內容:
1) App_Data/PublishProfiles 下的發布配置文件(.pubxml 文件)
2) 網站根目錄下的website.publishproj
website.publishproj 的目的是方便命令行發布。 然后你可以嘗試使用如下命令:
C:\Program Files (x86)\Microsoft Visual Studio 14.0>msbuild "C:\Users\UserName\Documents\Visual Studio2015\WebSites\WebSite1\website.publishproj" /p:deployOnBuild=true /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=14.0
請使用website.publishproj
代替 MSBuild 命令和任務,有關更多詳細信息,請查看此問題的答案: Publish Artifacts for website go to PrecompiledWeb
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.