I'm using following command to compile a project using msbuild with pre compile enabled
msbuild C:\WebGoat.NET-master\WebGoat\WebGoat.NET.csproj /p:OutputPath=bin /p:DeployOnBuild=true /p:WebPublishMethod="FileSystem";PrecompileBeforePublish=true;EnableUpdateable=false;DebugSymbols=true /p:UseMerge=true;WDPMergeOption="MergeAllOutputsToASingleAssembly";SingleAssemblyName="ContosoWebPrecompiled"
Build is getting failed with following error message
"C:\WebGoat.NET-master\WebGoat\WebGoat.NET.csproj" (default target) (1) -> (GenerateAssemblyInfoFromExistingAssembleInfo target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge .targets(289,5): error : @(_AspNetCompile_AssemblyInfo_Count) have 0 item(s) in the collection. It should only have 1 i tem(s). [C:\WebGoat.NET-master\WebGoat\WebGoat.NET.csproj] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge .targets(296,5): error : Target GenerateAssemblyInfoFromExistingAssembleInfo Failed [C:\WebGoat.NET-master\WebGoat\WebG oat.NET.csproj]
Please help me to resolve this issue.
You are missing AssemblyInfo.cs in your Properties folder.
Add this file using Visual Studio - Solution Explorer - Properties right-click - Add New Item - Assembly Info File.
来源:https://stackoverflow.com/questions/44265423/msbuild-failure-when-precompilebeforepublish-is-enabled