diff options
Diffstat (limited to 'clr.targets')
-rw-r--r-- | clr.targets | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/clr.targets b/clr.targets new file mode 100644 index 0000000000..5572178c4e --- /dev/null +++ b/clr.targets @@ -0,0 +1,94 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + + <!-- Differences in the native vs managed devdiv targets mean that we want to output to + IntermediateOutputDirectory under native, since we can set BinplaceRoot and have + BinPlace do all the final copying of binaries and pdbs. We output to BinariesDirectory + under managed, since BinplaceRoot doesn't exist in Microsoft.DevDiv.targets + --> + <PropertyGroup> + <OutputPath Condition="'$(ProjectLanguage)' != 'Native'">$(BinariesDirectory)\</OutputPath> + <OutputPath Condition="'$(LinkResourceOnlyDll)' == 'true' and '$(ResourceOnlyDllWithSymbols)' != 'true'">$(BinariesDirectory)\</OutputPath> + </PropertyGroup> + + <!-- Import the file that based on feature flags generates the defines --> + <Import Project="$(MSBuildThisFileDirectory)clr.defines.targets" /> + + <!-- + Assembly Signing + + NTBuild uses a central file list to determine which assemblies get binplaced and signed. + Reuse this for our build so we correctly sign only that which needs signing and don't + blindly sign everything. + --> + <PropertyGroup> + <SignFile Condition="$(SignFile)==''">$(IntermediateOutputDirectory)\sign.txt</SignFile> + </PropertyGroup> + + <Target Name="GenerateSignFile" + Condition="'$(ProjectLanguage)' != 'Native'" + Inputs="@(FileList)" + Outputs="$(SignFile)" + BeforeTargets="CheckIfAssemblyNeedsSigning"> + <Exec Command="$(DevDivToolsPath)\gensignfile.bat $(SignFile) @(FileList) $(BuildProjectName)" + StandardOutputImportance="Normal"/> + </Target> + + <PropertyGroup> + <CheckIfAssemblyNeedsSigningDependsOn Condition="'$(ProjectLanguage)' == 'Native'">GenerateAssemblyAttributes</CheckIfAssemblyNeedsSigningDependsOn> + <CheckIfAssemblyNeedsSigningDependsOn Condition="'$(ProjectLanguage)' != 'Native'">Preprocess</CheckIfAssemblyNeedsSigningDependsOn> + </PropertyGroup> + <Target Name="CheckIfAssemblyNeedsSigning" + Condition="'$(ProjectLanguage)' != 'Native' and '$(AlwaysSign)' != 'true'" + AfterTargets="GenerateSignFile" + BeforeTargets="$(CheckIfAssemblyNeedsSigningDependsOn)"> + <Exec Command="findstr /i /x /c:"$(TargetFileName)" $(SignFile) >nul 2>&1" IgnoreExitCode="true"> + <Output TaskParameter="ExitCode" PropertyName="ExitCode" /> + </Exec> + + <PropertyGroup> + <SignAssemblyAttribute Condition="'$(ExitCode)' == '0'">true</SignAssemblyAttribute> + <SignAssemblyAttribute Condition="'$(ExitCode)' != '0'">false</SignAssemblyAttribute> + </PropertyGroup> + + <ItemGroup> + <Internal_ClDefines Condition="'$(ExitCode)' != '0'" Remove="SIGN_ASSEMBLY=1" /> + </ItemGroup> + <Message Text="CheckIfAssemblyNeedsSigning assembly: $(TargetFileName) Exitcode: $(ExitCode) SignAssemblyAttribute: $(SignAssemblyAttribute)" /> + </Target> + + <!-- Overriding a Target that's defined in Microsoft.DevDiv.Common.targets since it uses the wrong defines and includes for RC in CSC projects --> + <Target Name="GenerateUnmanagedResources" + Condition="'@(RCResourceFile)' != '' and '$(CallRcFromCscProject)'=='true'" + DependsOnTargets="$(GenerateUnmanagedResourcesDependsOn)"> + + <PropertyGroup> + <Internal_GURIncludes>$(ClrBase)\src\inc</Internal_GURIncludes> + <Internal_GURIncludes>$(Internal_GURIncludes);$(VCPublicIncPath)</Internal_GURIncludes> + <Internal_GURIncludes>$(Internal_GURIncludes);$(EnlistmentRootPath)\ndp\inc\version</Internal_GURIncludes> + <Internal_GURIncludes>$(Internal_GURIncludes);$(EnlistmentRootPath)\InternalAPIs\NDP_Common\Inc</Internal_GURIncludes> + <Internal_GURIncludes>$(Internal_GURIncludes);$(SdkIncPath)</Internal_GURIncludes> + </PropertyGroup> + + <RC + AdditionalIncludeDirectories="$(Internal_GURIncludes)" + Culture="409" + TrackerLogDirectory="$(IntermediateOutputDirectory)" + MinimalRebuildFromTracking="$(Internal_MinimalRebuildFromTracking)" + PreprocessorDefinitions="$(CDefines)" + ResourceOutputFileName="@(RCResourceFile->'$(IntermediateOutputPath)%(Filename).res')" + Source="%(RCResourceFile.Identity)" + ToolPath="$(RCToolPath)" + TrackFileAccess="$(TrackFileAccess)" + SuppressStartupBanner="$(RCSupressStartupBanner)" + /> + <PropertyGroup> + <Win32Resource>@(RCResourceFile->'$(IntermediateOutputPath)%(Filename).res')</Win32Resource> + </PropertyGroup> + </Target> + + + <Import Project="clr.native.targets" Condition="'$(ProjectLanguage)' == 'Native'" /> + <Import Project="$(_NTDRIVE)$(_NTROOT)\InternalAPIs\NDP_Common\inc\Microsoft.Ndp.targets" /> + <Import Project="clr.prefast.targets" Condition="'$(DoPrefastBuild)' == 'true'" /> + +</Project> |