Skip to content

Commit d54c5b1

Browse files
committed
add missing build targets.
1 parent 436f2a7 commit d54c5b1

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

Directory.Build.props

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project InitialTargets="VerifyBuildProps">
2+
<!-- See: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets -->
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
<IsOfficialBuild Condition="'$(IsOfficialBuild)' == ''">false</IsOfficialBuild>
6+
7+
<!-- Because the default value in MSBuild doesn't get set until after Directory.Build.props, and we need it, we set the default here. -->
8+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
9+
</PropertyGroup>
10+
11+
<PropertyGroup Label="Build layout">
12+
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
13+
<SrcRoot>$(RepoRoot)src\</SrcRoot>
14+
</PropertyGroup>
15+
16+
<PropertyGroup Label="Official build defaults" Condition="'$(IsOfficialBuild)' == 'true'">
17+
<Enable_Telemetry>true</Enable_Telemetry>
18+
</PropertyGroup>
19+
20+
<!-- Use our dev nuget config when requested. -->
21+
<PropertyGroup Label="Dev Nuget config" Condition="'$(UseNugetDevConfig)' == 'true' and '$(IsOfficialBuild)' != 'true'">
22+
<RestoreConfigFile Condition="'$(RestoreConfigFile)' == ''">$(RepoRoot)nuget.dev.config</RestoreConfigFile>
23+
24+
<!-- since we're using dev nuget packages, lets prevent dirtying up the local nuget cache folder -->
25+
<RestorePackagesPath>$(RepoRoot)obj\.nuget-cache</RestorePackagesPath>
26+
</PropertyGroup>
27+
28+
<Target Name="VerifyBuildProps">
29+
<Error Condition="'$(isOfficialBuild)' == 'true' and '$(UseNugetDevConfig)' == 'true'"
30+
Text="UseNugetDevConfig cannot be set for official builds." />
31+
<Error Condition="'$(isOfficialBuild)' == 'true' and '$(PublishToDevNugetFeed)' == 'true'"
32+
Text="PublishToDevNugetFeed cannot be set for official builds." />
33+
34+
<Error Condition="('$(UseNugetDevConfig)' == 'true' or '$(PublishToDevNugetFeed)' == 'true') and '$(NUGET_LOCAL_DEV_PACKAGES)' == ''"
35+
Text="The environment variable 'NUGET_LOCAL_DEV_PACKAGES' is not set. This is required to use any of the arguments: UseNugetDevConfig, PublishToDevNugetFeed" />
36+
<Error Condition="'$(NUGET_LOCAL_DEV_PACKAGES)' != '' and !Exists('$(NUGET_LOCAL_DEV_PACKAGES)')"
37+
Text="The environment variable 'NUGET_LOCAL_DEV_PACKAGES' is set, but does not exist. Ensure it exists if specified." />
38+
</Target>
39+
</Project>

Directory.Build.targets

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project>
2+
<!-- See: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets -->
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Label="Build options for telemetry">
8+
<!-- This needs to be done in .targets, as some projects set DefineConstants but don't concatenate with existing values. -->
9+
<DefineConstants Condition="'$(Enable_Telemetry)' == 'true'">$(DefineConstants);PROD_CUSTOMER_TELEMETRY</DefineConstants>
10+
</PropertyGroup>
11+
</Project>

0 commit comments

Comments
 (0)