无法使用MSBuild发布Visual Studio解决方案文件

时间:2017-01-09 14:10:59

标签: visual-studio-2015 build msbuild solution

您正在尝试使用MSBuild发布Visual Studio解决方案文件。 我能够使用visual studio 2015发布,而当我尝试使用MSBuild构建和发布网站时。我看到构建成功,输出目录路径是用一些dll而不是整个项目创建的。 该解决方案有多个项目,我将解决方案分解为单个项目并开始单独构建。 通过类似的方法,我能够单独构建和发布另一个项目,但是当我试图发布这个时,我所看到的只有4个警告并且构建成功。 任何帮助将不胜感激。

跟随cmd运行以构建和发布:

C:\Program Files (x86)\MSBuild\14.0\Bin>MSBuild E:\CI\CorpAppSource_Timesheet\Co
nsilio.IMS.sln /t:build /p:VisualStudioVersion=14.0 /p:Configuration=Release /p:
DeployOnBuild=false /p:OutputPath=E:\Naresh

Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 1/9/2017 7:51:26 AM.
Project "E:\CI\CorpAppSource_Timesheet\Consilio.IMS.sln" on node 1 (build targe
t(s)).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Any CPU".
Project "E:\CI\CorpAppSource_Timesheet\Consilio.IMS.sln" (1) is building "E:\CI
\CorpAppSource_Timesheet\IMS.Library\Library.csproj" (2) on node 1 (default tar
gets).
PrepareForBuild:
  Creating directory "E:\Naresh\".
ResolveAssemblyReferences:
  Could not read state file "obj\Release\Library.csprojResolveAssemblyReference
  .cache". The format of this state file is not valid.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fi
les are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
_CopyFilesMarkedCopyLocal:
  Copying file from "E:\CI\CorpAppSource_Timesheet\IMS.Library\3rd Party Librar
  ies\log4net.dll" to "E:\Naresh\log4net.dll".
_CopyAppConfigFile:
  Copying file from "app.config" to "E:\Naresh\IMS.Library.dll.config".
CopyFilesToOutputDirectory:
  Copying file from "obj\Release\IMS.Library.dll" to "E:\Naresh\IMS.Library.dll
  ".
  Library -> E:\Naresh\IMS.Library.dll
  Copying file from "obj\Release\IMS.Library.pdb" to "E:\Naresh\IMS.Library.pdb
  ".
Done Building Project "E:\CI\CorpAppSource_Timesheet\IMS.Library\Library.csproj
" (default targets).

Project "E:\CI\CorpAppSource_Timesheet\Consilio.IMS.sln" (1) is building "E:\CI
\CorpAppSource_Timesheet\FADV.IMS\IMS.Core\FADV.IMS.Core.csproj" (3) on node 1
(default targets).
Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core\FADV.IMS.Core.csproj"
(3) is building "E:\CI\CorpAppSource_Timesheet\FADV.Util\FADV.Util.csproj" (4)
on node 1 (default targets).
ResolveAssemblyReferences:
  Could not read state file "obj\Release\FADV.Util.csprojResolveAssemblyReferen
  ce.cache". The format of this state file is not valid.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
CopyFilesToOutputDirectory:
  Copying file from "obj\Release\FADV.Util.dll" to "E:\Naresh\FADV.Util.dll".
  FADV.Util -> E:\Naresh\FADV.Util.dll
  Copying file from "obj\Release\FADV.Util.pdb" to "E:\Naresh\FADV.Util.pdb".
Done Building Project "E:\CI\CorpAppSource_Timesheet\FADV.Util\FADV.Util.csproj
" (default targets).

Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core\FADV.IMS.Core.csproj"
(3) is building "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core.Base\FADV.IMS.
Core.Base.csproj" (5) on node 1 (default targets).
Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core.Base\FADV.IMS.Core.Bas
e.csproj" (5) is building "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Data\FADV
.IMS.Data.csproj" (6) on node 1 (default targets).
ResolveAssemblyReferences:
  Could not read state file "obj\Release\FADV.IMS.Data.csprojResolveAssemblyRef
  erence.cache". The format of this state file is not valid.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
CopyFilesToOutputDirectory:
  Copying file from "obj\Release\FADV.IMS.Data.dll" to "E:\Naresh\FADV.IMS.Data
  .dll".
  FADV.IMS.Data -> E:\Naresh\FADV.IMS.Data.dll
  Copying file from "obj\Release\FADV.IMS.Data.pdb" to "E:\Naresh\FADV.IMS.Data
  .pdb".
Done Building Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Data\FADV.IMS
.Data.csproj" (default targets).

ResolveAssemblyReferences:
  Could not read state file "obj\Release\FADV.IMS.Core.Base.csprojResolveAssemb
  lyReference.cache". The format of this state file is not valid.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
CopyFilesToOutputDirectory:
  Copying file from "obj\Release\FADV.IMS.Core.Base.dll" to "E:\Naresh\FADV.IMS
  .Core.Base.dll".
  FADV.IMS.Core.Base -> E:\Naresh\FADV.IMS.Core.Base.dll
  Copying file from "obj\Release\FADV.IMS.Core.Base.pdb" to "E:\Naresh\FADV.IMS
  .Core.Base.pdb".
Done Building Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core.Base\FAD
V.IMS.Core.Base.csproj" (default targets).

Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core\FADV.IMS.Core.csproj"
(3) is building "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Security\FADV.IMS.S
ecurity.csproj" (7) on node 1 (default targets).
ResolveAssemblyReferences:
  Could not read state file "obj\Release\FADV.IMS.Security.csprojResolveAssembl
  yReference.cache". The format of this state file is not valid.
CoreResGen:
  No resources are out of date with respect to their source files. Skipping res
  ource generation.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
CopyFilesToOutputDirectory:
  Copying file from "obj\Release\FADV.IMS.Security.dll" to "E:\Naresh\FADV.IMS.
  Security.dll".
  FADV.IMS.Security -> E:\Naresh\FADV.IMS.Security.dll
  Copying file from "obj\Release\FADV.IMS.Security.pdb" to "E:\Naresh\FADV.IMS.
  Security.pdb".
Done Building Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Security\FADV
.IMS.Security.csproj" (default targets).

ResolveAssemblyReferences:
  Could not read state file "obj\Release\FADV.IMS.Core.csprojResolveAssemblyRef
  erence.cache". The format of this state file is not valid.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
GenerateSerializationAssemblies:
Skipping target "GenerateSerializationAssemblies" because all output files are
up-to-date with respect to the input files.
_CopyAppConfigFile:
  Copying file from "app.config" to "E:\Naresh\FADV.IMS.Core.dll.config".
CopyFilesToOutputDirectory:
  Copying file from "obj\Release\FADV.IMS.Core.dll" to "E:\Naresh\FADV.IMS.Core
  .dll".
  FADV.IMS.Core -> E:\Naresh\FADV.IMS.Core.dll
  Copying file from "obj\Release\FADV.IMS.Core.XmlSerializers.dll" to "E:\Nares
  h\FADV.IMS.Core.XmlSerializers.dll".
  Copying file from "obj\Release\FADV.IMS.Core.pdb" to "E:\Naresh\FADV.IMS.Core
  .pdb".
Done Building Project "E:\CI\CorpAppSource_Timesheet\FADV.IMS\IMS.Core\FADV.IMS
.Core.csproj" (default targets).

Project "E:\CI\CorpAppSource_Timesheet\Consilio.IMS.sln" (1) is building "E:\CI
\CorpAppSource_Timesheet\Timesheet.metaproj" (8) on node 1 (default targets).
E:\CI\CorpAppSource_Timesheet\Timesheet.metaproj : warning MSB3274: The primary
 reference "E:\Naresh\IMS.Library.dll" could not be resolved because it was bui
lt against the ".NETFramework,Version=v4.5" framework. This is a higher version
 than the currently targeted framework ".NETFramework,Version=v4.0".
  Copying file from "E:\Naresh\FADV.IMS.Security.dll" to "..\CorpAppSource_Time
  sheet\FADV.IMS\Timesheet\\Bin\FADV.IMS.Security.dll".
  Copying file from "E:\Naresh\FADV.IMS.Data.dll" to "..\CorpAppSource_Timeshee
  t\FADV.IMS\Timesheet\\Bin\FADV.IMS.Data.dll".
  Copying file from "E:\Naresh\FADV.Util.dll" to "..\CorpAppSource_Timesheet\FA
  DV.IMS\Timesheet\\Bin\FADV.Util.dll".
  Copying file from "E:\Naresh\FADV.IMS.Core.Base.dll" to "..\CorpAppSource_Tim
  esheet\FADV.IMS\Timesheet\\Bin\FADV.IMS.Core.Base.dll".
  Copying file from "E:\Naresh\FADV.IMS.Security.pdb" to "..\CorpAppSource_Time
  sheet\FADV.IMS\Timesheet\\Bin\FADV.IMS.Security.pdb".
  Copying file from "E:\Naresh\FADV.IMS.Data.pdb" to "..\CorpAppSource_Timeshee
  t\FADV.IMS\Timesheet\\Bin\FADV.IMS.Data.pdb".
  Copying file from "E:\Naresh\FADV.Util.pdb" to "..\CorpAppSource_Timesheet\FA
  DV.IMS\Timesheet\\Bin\FADV.Util.pdb".
  Copying file from "E:\Naresh\FADV.IMS.Core.Base.pdb" to "..\CorpAppSource_Tim
  esheet\FADV.IMS\Timesheet\\Bin\FADV.IMS.Core.Base.pdb".
  Copying file from "E:\Naresh\FADV.IMS.Core.dll" to "..\CorpAppSource_Timeshee
  t\FADV.IMS\Timesheet\\Bin\FADV.IMS.Core.dll".
  Copying file from "E:\Naresh\FADV.IMS.Core.pdb" to "..\CorpAppSource_Timeshee
  t\FADV.IMS\Timesheet\\Bin\FADV.IMS.Core.pdb".
  Copying file from "E:\Naresh\FADV.IMS.Core.XmlSerializers.dll" to "..\CorpApp
  Source_Timesheet\FADV.IMS\Timesheet\\Bin\FADV.IMS.Core.XmlSerializers.dll".
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /Timeshe
  et -p ..\CorpAppSource_Timesheet\FADV.IMS\Timesheet\ -u -f PrecompiledWeb\Tim
  esheet\
e:\CI\CorpAppSource_Timesheet\FADV.IMS\Timesheet\App_Code\TimeSheetService.cs(3
72): warning CS0108: 'TimeSheetService.oSecurityRoot' hides inherited member 'I
MSUserPermission.oSecurityRoot'. Use the new keyword if hiding was intended. [E
:\CI\CorpAppSource_Timesheet\Timesheet.metaproj]
e:\CI\CorpAppSource_Timesheet\FADV.IMS\Timesheet\App_Code\TimeSheetService.cs(3
83): warning CS0108: 'TimeSheetService.oSystemRoot' hides inherited member 'IMS
UserPermission.oSystemRoot'. Use the new keyword if hiding was intended. [E:\CI
\CorpAppSource_Timesheet\Timesheet.metaproj]
e:\CI\CorpAppSource_Timesheet\FADV.IMS\Timesheet\UserControls\ParentObjectMenuU
C.ascx.cs(744): warning CS0618: 'System.Xml.XmlDataDocument' is obsolete: 'XmlD
ataDocument class will be removed in a future release.' [E:\CI\CorpAppSource_Ti
mesheet\Timesheet.metaproj]
Done Building Project "E:\CI\CorpAppSource_Timesheet\Timesheet.metaproj" (defau
lt targets).

Done Building Project "E:\CI\CorpAppSource_Timesheet\Consilio.IMS.sln" (build t
arget(s)).


Build succeeded.

"E:\CI\CorpAppSource_Timesheet\Consilio.IMS.sln" (build target) (1) ->
"E:\CI\CorpAppSource_Timesheet\Timesheet.metaproj" (default target) (8) ->
(Build target) ->
  E:\CI\CorpAppSource_Timesheet\Timesheet.metaproj : warning MSB3274: The prima
ry reference "E:\Naresh\IMS.Library.dll" could not be resolved because it was b
uilt against the ".NETFramework,Version=v4.5" framework. This is a higher versi
on than the currently targeted framework ".NETFramework,Version=v4.0".
  e:\CI\CorpAppSource_Timesheet\FADV.IMS\Timesheet\App_Code\TimeSheetService.cs
(372): warning CS0108: 'TimeSheetService.oSecurityRoot' hides inherited member
'IMSUserPermission.oSecurityRoot'. Use the new keyword if hiding was intended.
[E:\CI\CorpAppSource_Timesheet\Timesheet.metaproj]
  e:\CI\CorpAppSource_Timesheet\FADV.IMS\Timesheet\App_Code\TimeSheetService.cs
(383): warning CS0108: 'TimeSheetService.oSystemRoot' hides inherited member 'I
MSUserPermission.oSystemRoot'. Use the new keyword if hiding was intended. [E:\
CI\CorpAppSource_Timesheet\Timesheet.metaproj]
  e:\CI\CorpAppSource_Timesheet\FADV.IMS\Timesheet\UserControls\ParentObjectMen
uUC.ascx.cs(744): warning CS0618: 'System.Xml.XmlDataDocument' is obsolete: 'Xm
lDataDocument class will be removed in a future release.' [E:\CI\CorpAppSource_
Timesheet\Timesheet.metaproj]

    4 Warning(s)
    0 Error(s)

Time Elapsed 00:00:12.83

2 个答案:

答案 0 :(得分:0)

您需要设置DeployOnBuild = true而不是false,之后Web应用程序项目将发布到E:\ Naresh \ _PublishedWebsites文件夹。

另一方面,如果解决方案中包含网站项目,则需要为msbuild.exe指定website.publishproj(网站根文件夹)以单独发布网站项目。更多信息,您可以参考这个主题:

How to use command line msbuild to deploy VS2012 Web Site project without precompiling it

答案 1 :(得分:0)

您可以在

下创建自定义构建操作

Properties - > Build Events - > Post-build event command line

这里只需编写一个简单的批处理命令,将缺少的dll从yuor项目文件夹复制到目标输出目录。

您可能会发现选择Edit Post-Build...并查看哪些宏可用于帮助您编写通用命令很有用。如果需要,您也可以添加自己的。

希望这有帮助