I have an msbuild argument
/t:Project.HQ.Web /p:DeployOnBuild=true /p:WebPublishMethod=Package
/p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true
/p:PackageLocation="$(build.artifactstagingdirectory)\\"
in my Azure DevOps Build pipeline for Solution Build.
I get an error that says
Agent job 1: "Code\AnotherMutliProjSolution.sln(0,0): Error MSB4014: The build stopped unexpectedly because of an internal failure. System.ArgumentException: The name "Project.HQ.Web" contains an invalid character ".". at Microsoft.Build.Shared.ErrorUtilities.ThrowArgument(Exception innerException, String resourceName, Object[] args) at Microsoft.Build.Construction.ProjectTargetElement.set_Name(String value) at Microsoft.Build.Construction.ProjectTargetElement.CreateDisconnected(String name, ProjectRootElement containingProject) at Microsoft.Build.Execution.ProjectTargetInstance.ToProjectTargetElement(ProjectRootElement rootElement) at Microsoft.Build.Execution.ProjectInstance.ToProjectRootElement() at Microsoft.Build.Construction.SolutionProjectGenerator.CreateSolutionProject(String wrapperProjectToolsVersion, Boolean explicitToolsVersionSpecified) at Microsoft.Build.Construction.SolutionProjectGenerator.Generate() at Microsoft.Build.Execution.ProjectInstance.GenerateSolutionWrapper(String projectFile, IDictionary
2 globalProperties, String toolsVersion, ILoggingService loggingService, BuildEventContext projectBuildEventContext, IReadOnlyCollection
1 targetNames, ISdkResolverService sdkResolverService, Int32 submissionId) at Microsoft.Build.Execution.ProjectInstance.LoadSolutionForBuild(String projectFile, PropertyDictionary1 globalPropertiesInstances, String toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext projectBuildEventContext, Boolean isExplicitlyLoaded, IReadOnlyCollection
1 targetNames, ISdkResolverService sdkResolverService, Int32 submissionId) at Microsoft.Build.Execution.BuildManager.LoadSolutionIntoConfiguration(BuildRequestConfiguration config, BuildRequest request) at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker) at Microsoft.Build.Execution.BuildManager.IssueRequestToScheduler(BuildSubmission submission, Boolean allowMainThreadBuild, BuildRequestBlocker blocker)" Review
I have tried having a my target set as 'Project.HQ.Web' and "Project.HQ.Web". I still run into the same issues.
You need to replace the .
with underscores to build the generated solution targets:
msbuild /t:Project_HQ_Web
See the following part of How to: Build specific targets in solutions by using MSBuild.exe
Specify the target after the -target: switch in the format
<ProjectName>:<TargetName>
. If the project name contains any of the characters %, $, @, ;, ., (, ), or ', replace them with an _ in the specified target name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With