Common MSBuild Project Items

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

In MSBuild, an item is a named reference to one or more files. Items contain metadata such as file names, paths, and version numbers. All project types in Visual Studio have several items in common. These items are defined in the file microsoft.build.commontypes.xsd.

The following is a list of all the common project items.

Reference

Represents an assembly (managed) reference in the project.

Item NameDescription
HintPathOptional string. Relative or absolute path of the assembly.
NameOptional string. The display name of the assembly, for example, "System.Windows.Forms."
FusionNameOptional string. Specifies the simple or strong fusion name for the item.

When this attribute is present, it can save time because the assembly file does not have to be opened to obtain the fusion name.
SpecificVersionOptional boolean. Specifies whether only the version in the fusion name should be referenced.
AliasesOptional string. Any aliases for the reference.
PrivateOptional boolean. Specifies whether the reference should be copied to the output folder. This attribute matches the Copy Local property of the reference that's in the Visual Studio IDE.

COMReference

Represents a COM (unmanaged) component reference in the project.

Item NameDescription
NameOptional string. The display name of the component.
GuidOptional string. A GUID for the component, in the form {12345678-1234-1234-1234-1234567891234}.
VersionMajorOptional string. The major part of the version number of the component. For example, "5" if the full version number is "5.46."
VersionMinorOptional string. The minor part of the version number of the component. For example, "46" if the full version number is "5.46."
LCIDOptional string. The LocaleID for the component.
WrapperToolOptional string. The name of the wrapper tool that is used on the component, for example, "tlbimp."
IsolatedOptional boolean. Specifies whether the component is a reg-free component.

COMFileReference

Represents a list of type libraries that feed into the ResolvedComreference target.

Item NameDescription
WrapperToolOptional string. The name of the wrapper tool that is used on the component, for example, "tlbimp."

NativeReference

Represents a native manifest file or a reference to such a file.

Item NameDescription
NameRequired string. The base name of the manifest file.
HintPathRequired string. The relative path of the manifest file.

ProjectReference

Represents a reference to another project.

Item NameDescription
NameOptional string. The display name of the reference.
ProjectOptional string. A GUID for the reference, in the form {12345678-1234-1234-1234-1234567891234}.
PackageOptional string. The path of the project file that is being referenced.

Compile

Represents the source files for the compiler.

Item NameDescription
DependentUponOptional string. Specifies the file this file depends on to compile correctly.
AutoGenOptional boolean. Indicates whether the file was generated for the project by the Visual Studio integrated development environment (IDE).
LinkOptional string. The notational path to be displayed when the file is physically located outside the influence of the project file.
VisibleOptional boolean. Indicates whether to display the file in Solution Explorer in Visual Studio.
CopyToOutputDirectoryOptional string. Determines whether to copy the file to the output directory. Values are:

1. Never
2. Always
3. PreserveNewest

EmbeddedResource

Represents resources to be embedded in the generated assembly.

Item NameDescription
DependentUponOptional string. Specifies the file this file depends on to compile correctly
GeneratorRequired string. The name of any file generator that is run on this item.
LastGenOutputRequired string. The name of the file that was created by any file generator that ran on this item.
CustomToolNamespaceRequired string. The namespace in which any file generator that runs on this item should create code.
LinkOptional string. The notational path is displayed if the file is physically located outside the influence of the project.
VisibleOptional boolean. Indicates whether to display the file in Solution Explorer in Visual Studio.
CopyToOutputDirectoryOptional string. Determines whether to copy the file to the output directory. Values are:

1. Never
2. Always
3. PreserveNewest
LogicalNameRequired string. The logical name of the embedded resource.

Content

Represents files that are not compiled into the project, but may be embedded or published together with it.

Item NameDescription
DependentUponOptional string. Specifies the file this file depends on to compile correctly.
GeneratorRequired string. The name of any file generator that runs on this item.
LastGenOutputRequired string. The name of the file that was created by any file generator that was run on this item.
CustomToolNamespaceRequired string. The namespace in which any file generator that runs on this item should create code.
LinkOptional boolean. Indicates whether to display the file in Solution Explorer in Visual Studio.
PublishStateRequired string. The publish state of the content, either:

- Default
- Included
- Excluded
- DataFile
- Prerequisite
IsAssemblyOptional boolean. Specifies whether the file is an assembly.
VisibleOptional boolean. Indicates whether to display the file in Solution Explorer in Visual Studio.
CopyToOutputDirectoryOptional string. Determines whether to copy the file to the output directory. Values are:

1. Never
2. Always
3. PreserveNewest

None

Represents files that should have no role in the build process.

Item NameDescription
DependentUponOptional string. Specifies the file this file depends on to compile correctly.
GeneratorRequired string. The name of any file generator that is run on this item.
LastGenOutputRequired string. The name of the file that was created by any file generator that ran on this item.
CustomToolNamespaceRequired string. The namespace in which any file generator that runs on this item should create code.
LinkOptional string. The notational path to be displayed if the file is physically located outside the influence of the project.
VisibleOptional boolean. Indicates whether to display the file in Solution Explorer in Visual Studio.
CopyToOutputDirectoryOptional string. Determines whether to copy the file to the output directory. Values are:

1. Never
2. Always
3. PreserveNewest

BaseApplicationManifest

Represents the base application manifest for the build, and contains ClickOnce deployment security information.

CodeAnalysisImport

Represents the FxCop project to import.

Import

Represents assemblies whose namespaces should be imported by the Visual Basic compiler.

Common MSBuild Project Properties

Show: