Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the existing build targets for MSBuild?

MSBuild allows you to specify build-targets such as Build or Clean with -target:<build-target> (Example: MSBuild.exe -target:Clean).

Of course, a developer can define their own target using a .targets xml file.

However, some targets, such as Build or Clean, are pre-defined by Microsoft.

What is the list of all default pre-defined build-targets that are common for all .NET languages?

like image 928
cowlinator Avatar asked Aug 30 '19 00:08

cowlinator


People also ask

What are MSBuild targets?

A target element can have both Inputs and Outputs attributes, indicating what items the target expects as input, and what items it produces as output. If all output items are up-to-date, MSBuild skips the target, which significantly improves the build speed. This is called an incremental build of the target.

Will MSBuild compile without any target?

If MSBuild determines that any output files are out of date with respect to the corresponding input file or files, then MSBuild executes the target. Otherwise, MSBuild skips the target. After the target is executed or skipped, any other target that lists it in an AfterTargets attribute is run.

How do you build specific targets in solutions using MSBuild exe?

To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.

What does build target mean?

A build target is a string that identifies a build rule in your project. Build targets are used as arguments to Buck commands, such as buck build and buck run . Build targets are also used as arguments to build rules to enable one build rule to reference another.


Video Answer


1 Answers

The standard build-targets that are common for all .NET languages are defined at Microsoft.Common.CurrentVersion.targets.

Here is the full list of build targets:

  • Build
  • Rebuild
  • Clean
  • Run
  • Publish
  • PublishOnly
  • ResolveReferences
  • ResolveProjectReferences
  • ResolveAssemblyReferences
  • GenerateBindingRedirects
  • PrepareResources
  • ResGen
  • Compile
  • GenerateManifests
  • PrepareForRun
  • CopyFilesToOutputDirectory
  • CoreBuild
  • BuildGenerateSources
  • BuildCompile
  • BuildLink
  • CopyRunEnvironmentFiles
  • BuildOnlySettings
  • PrepareForBuild
  • GetFrameworkPaths
  • GetReferenceAssemblyPaths
  • AssignLinkMetadata
  • PreBuildEvent
  • UnmanagedUnregistration
  • GetTargetFrameworkVersion
  • AssignProjectConfiguration
  • GetTargetPath
  • GetTargetPathWithTargetPlatformMoniker
  • GetNativeManifest
  • ResolveNativeReferences
  • GenerateBindingRedirects
  • GenerateBindingRedirectsUpdateAppConfig
  • ResolveSDKReferences
  • FindInvalidProjectReferences
  • ExpandSDKReferences
  • ExportWindowsMDFile
  • DesignTimeResolveAssemblyReferences
  • ResolveComReferences
  • PrepareResourceNames
  • AssignTargetPaths
  • GetItemTargetPaths
  • SplitResourcesByCulture
  • CreateCustomManifestResourceNames
  • ResolveKeySource
  • GenerateTargetFrameworkMonikerAttribute
  • GenerateAdditionalSources
  • GenerateSerializationAssemblies
  • CreateSatelliteAssemblies
  • GenerateSatelliteAssemblies
  • ComputeIntermediateSatelliteAssemblies
  • SetWin32ManifestProperties
  • GenerateApplicationManifest
  • GenerateDeploymentManifest
  • GetCopyToOutputDirectoryItems
  • UnmanagedRegistration
  • IncrementalClean
  • CleanReferencedProjects
  • CleanPublishFolder
  • PostBuildEvent
  • SetGenerateManifests
  • PublishBuild
  • AllProjectOutputGroups
  • BuiltProjectOutputGroup
  • DebugSymbolsProjectOutputGroup
  • DocumentationProjectOutputGroup
  • SatelliteDllsProjectOutputGroup
  • SourceFilesProjectOutputGroup
  • ContentFilesProjectOutputGroup
  • SGenFilesOutputGroup
  • GetResolvedSDKReferences
  • PriFilesOutputGroup
  • SDKRedistOutputGroup
  • GetInstalledSDKs
  • Restore
  • BeforeBuild
  • AfterBuild
  • BeforeRebuild
  • AfterRebuild
  • BeforeResolveReferences
  • AfterResolveReferences
  • BeforeResGen
  • AfterResGen
  • BeforeCompile
  • AfterCompile
  • BeforeClean
  • AfterClean
  • BeforePublish
  • AfterPublish

The targets that are prefixed with Before or After are intended to be overridden in projects.

like image 131
cowlinator Avatar answered Nov 09 '22 07:11

cowlinator