/
Directory.build.props
134 lines (123 loc) · 6.59 KB
/
Directory.build.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsBuildingWpfTempProj Condition="$(MSBuildProjectName.Contains('_wpftmp')) != 'true'">false</IsBuildingWpfTempProj>
<IsBuildingWpfTempProj Condition="$(MSBuildProjectName.Contains('_wpftmp')) == 'true'">true</IsBuildingWpfTempProj>
</PropertyGroup>
<!-- Project properties -->
<PropertyGroup>
<TargetFrameworks>net462;net47;netcoreapp3.1;net5.0-windows;uap10.0.18362</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AutoGenerateBindingRedirects Condition=" $(TargetFramework.StartsWith('net4')) or $(TargetFramework.StartsWith('uap')) ">true</AutoGenerateBindingRedirects>
<LangVersion>latest</LangVersion>
<DebugSymbols>true</DebugSymbols>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<NoError>$(NoError);CS1591</NoError>
</PropertyGroup>
<!-- .NET Framework and Core -->
<PropertyGroup Condition=" !$(TargetFramework.StartsWith('uap')) ">
<UseWpf>true</UseWpf>
<DebugType>Embedded</DebugType>
</PropertyGroup>
<!-- UAP -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('uap')) ">
<DefaultTargetPlatformVersion>18362</DefaultTargetPlatformVersion>
<DefaultTargetPlatformMinVersion>18362</DefaultTargetPlatformMinVersion>
<UseWindowsDesktopSdk>true</UseWindowsDesktopSdk>
<EnableDefaultXamlItems>true</EnableDefaultXamlItems>
<DebugType>full</DebugType>
<!-- 8002 is a strong named -> non-strong-named reference -->
<!-- This is valid for platforms other than .NET Framework (and is needed for the UWP targets -->
<NoWarn>$(NoWarn);8002</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" $(TargetFramework.StartsWith('uap')) and '$(Configuration)' == 'Release' ">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<!-- SourceLink -->
<PropertyGroup>
<!-- Optional: Declare that the Repository URL can be published to NuSpec -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- <IncludeSymbols>true</IncludeSymbols> -->
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Optional: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb;.xaml;.xml</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!-- https://github.com/dotnet/sourcelink/blob/master/docs/README.md#embedallsources -->
<EmbedAllSources>True</EmbedAllSources>
</PropertyGroup>
<!-- Add the references for all projects and targets -->
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.*" PrivateAssets="All" IncludeAssets="build;compile" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Remove="**\*.png;**\*.jpg;**\*.ico;**\*.cur" />
<Resource Include="**\*.png;**\*.jpg;**\*.ico;**\*.cur" />
</ItemGroup>
<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
</ItemGroup>
<!--
Fix for .NET Core 3.0, see https://github.com/dotnet/core-sdk/issues/192, it
uses obj/release instead of [outputdirectory]
-->
<PropertyGroup Condition=" '$(DotNetPackIntermediateOutputPath)' != '' ">
<IntermediateOutputPath>$(DotNetPackIntermediateOutputPath)</IntermediateOutputPath>
</PropertyGroup>
<!--
// This task disable doc warnings in the auto-generated XamlTypeInfo.g.cs file,
// and also hides the public class from intellisense.
-->
<UsingTask TaskName="XamlTypeInfoBuildTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
//Note: If this task returns 'false' it will break the shared project manager project picker and intellisense.
//so we always return true.
try {
Log.LogMessage(MessageImportance.Normal, "XamlTypeInfoBuildTask: InputFilename = " + InputFilename);
if (!System.IO.File.Exists(InputFilename))
{
return true;
}
string code = System.IO.File.ReadAllText(InputFilename);
if (code.StartsWith("#pragma warning disable 1591")) //Already modified
return true;
int idx = code.IndexOf("[global::System.CodeDom.Compiler.GeneratedCodeAttribute");
if (idx < 0)
{
return true;
}
string insert = "[global::System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n ";
code = "#pragma warning disable 1591\n" + code.Substring(0, idx) + insert + code.Substring(idx) +
"#pragma warning restore 1591\n";
System.IO.File.WriteAllText(InputFilename, code);
Log.LogMessage(MessageImportance.Normal, "XamlTypeInfoBuildTask: File now modified");
return true;
}
catch (Exception ex) {
ex = new Exception("XamlTypeInfoBuildTask: " + ex.Message, ex);
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="XamlTypeInfoBuildTask"
Condition=" $(TargetFramework.StartsWith('uap')) and '$(DesignTimeBuild)' != 'true' "
AfterTargets="MarkupCompilePass2"
BeforeTargets="CoreCompile">
<XamlTypeInfoBuildTask InputFilename="$(IntermediateOutputPath)\XamlTypeInfo.g.cs" />
</Target>
</Project>