Not able to PUBLISH Visual Studio solution files using MSBuild

943 Views Asked by At

Hi am trying to PUBLISH Visual Studio solution files using MSBuild. I am able to publish using visual studio 2015, whereas when am trying to Build and publish the site using MSBuild. I see that the build is successful and the output directory path getting created with some dll's and not the entire project. The solution had multiple projects, I broke the solution into individual projects and started building individually. With similar approach i was able to build and publish another project individually but when am trying to publish this, all i get to see is 4 warnings and build to be successful. any help would be much appreciated.

Following cmd was run to build and publish:

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

There are 2 best solutions below

0
On

You can create a custom build action under

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

Here just write a simple batch command to copy the missing dlls from yuor project folder to the target output directory.

You may find it useful to select Edit Post-Build... and see what macros are available to help you write a generic command. You can also add your own if required.

Hope this helps

10
On

You need to set DeployOnBuild=true instead of false, after that the web application projects will be published to E:\Naresh\ _PublishedWebsites folder.

On the other hand, you need to specify website.publishproj (web site root folder) for msbuild.exe to publish web site project individually if there is website project included in the solution. More information, you can refer to this thread:

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