Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
displayName: CodeQL
pool:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals windows.vs2017.amd64
demands: ImageOverride -equals windows.vs2019.amd64
timeoutInMinutes: 90

steps:
Expand Down
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

<PropertyGroup>
<!-- Require VS2017 so VS builds also use MSBuild v15.0. -->
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<!--
Suppress "MSBUILD : warning : Post-build Code Analysis (FxCopCmd.exe) has been deprecated in favor of FxCop
analyzers, which run during build. Refer to https://aka.ms/fxcopanalyzers to migrate to FxCop analyzers."
-->
<SuppressLegacyCodeAnalysisDeprecatedWarning>true</SuppressLegacyCodeAnalysisDeprecatedWarning>
</PropertyGroup>
</Project>
27 changes: 8 additions & 19 deletions Runtime.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<BuildPortable Condition=" '$(BuildPortable)' == '' ">true</BuildPortable>
<BuildInParallel Condition=" '$(BuildInParallel)' == '' And $(MSBuildNodeCount) &gt; 1 ">true</BuildInParallel>
<BuildInParallel Condition=" '$(BuildInParallel)' == '' ">false</BuildInParallel>
<RestoreInParallel Condition=" '$(RestoreInParallel)' == '' ">false</RestoreInParallel>
<TestInParallel Condition=" '$(TestInParallel)' == '' ">false</TestInParallel>
<TestResultsDirectory>$(MSBuildThisFileDirectory)bin\$(Configuration)\test\TestResults\</TestResultsDirectory>
<SkipStrongNamesExe>$(MSBuildThisFileDirectory)packages\Microsoft.Web.SkipStrongNames.1.0.0\tools\SkipStrongNames.exe</SkipStrongNamesExe>
Expand Down Expand Up @@ -64,24 +65,12 @@
</Target>

<Target Name="RestorePackages" DependsOnTargets="DownloadNuGet">
<ItemGroup>
<_NuGetPackagesAndSolutions Include="Runtime.sln" />

<!-- Avoid restoring RuntimePortable.sln directly. -->
<_NuGetPackagesAndSolutions Include="src\System.Net.Http.Formatting.NetCore\packages.config;
test\System.Net.Http.Formatting.NetCore.Test\packages.config"
Condition=" '$(BuildPortable)' == 'true' " />
<_ProjectsToRestore Include="test\System.Net.Http.Formatting.NetStandard.Test\System.Net.Http.Formatting.NetStandard.Test.csproj"
Condition=" '$(BuildPortable)' == 'true' " />
</ItemGroup>

<Message Text="Restoring NuGet packages..." Importance="High" />
<Exec Command='"$(NuGetExe)" restore "%(_NuGetPackagesAndSolutions.Identity)" ^
-PackagesDirectory packages -NonInteractive -Verbosity quiet' />
<MSBuild Projects="@(_ProjectsToRestore)" Targets="Restore"
BuildInParallel="$(BuildInParallel)"
Condition=" '$(BuildPortable)' == 'true' "
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);VisualStudioVersion=$(VisualStudioVersion)" />
<Message Text="%0ARestoring NuGet packages..." Importance="High" />
<MSBuild Projects="@(SolutionsToBuild)" Targets="Restore"
BuildInParallel="$(RestoreInParallel)"
Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);
RestorePackagesConfig=true;VisualStudioVersion=$(VisualStudioVersion)" />
<Message Importance="High" Text="" />
</Target>

<!-- Pick the right Microsoft.Web.FxCop package to use and copy it to a standard location. -->
Expand All @@ -96,7 +85,7 @@
Properties="Configuration=Release;OutputPath=$(CustomFxCopRulesPath)" />
</Target>

<Target Name="Build" DependsOnTargets="RestorePackages;BuildTools">
<Target Name="Build" DependsOnTargets="RestoreSkipStrongNames;RestorePackages;BuildTools">
<!-- we need to batch the solution files since they both build Microsoft.TestCommon -->
<Error Condition=" '$(CodeAnalysis)' == 'true' and '$(Configuration)' == 'Release' " Text="Unable to run code analysis in Release configuration. Release assemblies do not include SuppressMessage attributes (so code analysis would always fail with the errors that are normally suppressed)." />
<MakeDir Directories="bin\$(Configuration)" />
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2017.amd64.open
demands: ImageOverride -equals windows.vs2019.amd64.open
${{ else }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals windows.vs2017.amd64
demands: ImageOverride -equals windows.vs2019.amd64
timeoutInMinutes: 30

strategy:
Expand Down
29 changes: 19 additions & 10 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ mkdir bin

:Build

REM Find the most recent 32bit MSBuild.exe on the system. Require v15.0 (installed with VS2017) or later since .NET
REM Core projects are coming soon.
REM Use `vswhere` for the search since %ProgramFiles(x86)%\msbuild\15.0\Bin\MSBuild.exe almost never exists.
REM Find the most recent 32bit MSBuild.exe on the system. Require v16.0 (installed with VS2019) or later.
REM Use `vswhere` for the search because it can find all VS installations.
set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist %vswhere% (
set VsWhere="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
set vswhere="%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
)
if not exist %vswhere% (
REM vswhere.exe not in normal locations; check the Path.
Expand All @@ -25,19 +24,29 @@ if not exist %vswhere% (
goto BuildFail
)

REM We're fine w/ any .NET SDK newer than 2.1.500 but also need a 2.1.x runtime. Microsoft.Net.Core.Component.SDK.2.1
REM actually checks for only the runtime these days.
set InstallDir=
for /f "usebackq tokens=*" %%i in (`%vswhere% -version ^[15^,16^) -latest -prerelease -products * ^
-requires Microsoft.Component.MSBuild -requires Microsoft.Net.Core.Component.SDK.2.1 ^
for /f "usebackq tokens=*" %%i in (`%vswhere% -version 16 -latest -prerelease -products * ^
-requires Microsoft.Component.MSBuild ^
-requires Microsoft.NetCore.Component.SDK ^
-requires Microsoft.Net.Core.Component.SDK.2.1 ^
-property installationPath`) do (
set InstallDir=%%i
set InstallDir="%%i"
)
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
set MSBuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe"

if exist %InstallDir%\MSBuild\Current\Bin\MSBuild.exe (
set MSBuild=%InstallDir%\MSBuild\Current\Bin\MSBuild.exe
) else (
echo Could not find MSBuild.exe. Please install the VS2017 BuildTools component or a workload that includes it.
echo Could not find MSBuild.exe. Please install the VS2019 BuildTools component or a workload that includes it.
goto BuildFail
)

REM Configure NuGet operations to work w/in this repo i.e. do not pollute system packages folder.
REM Note this causes two copies of packages restored using packages.config to land in this folder e.g.
REM StyleCpy.5.0.0/ and stylecop/5.0.0/.
set "NUGET_PACKAGES=%CD%\packages"

REM Are we running in a local dev environment (not on CI)?
if DEFINED CI (set Desktop=false) else if DEFINED TEAMCITY_VERSION (set Desktop=false) else (set Desktop=true)

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "2.1.500",
"rollForward": "latestPatch"
"rollForward": "major"
}
}
2 changes: 2 additions & 0 deletions src/Strict.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
<IncludeAll Action="Error" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1062" Action="None" />
<!-- Ignore int.ToString(...) calls w/o an IFormatProvider in old code. -->
<Rule Id="CA1305" Action="None" />
</Rules>
</RuleSet>
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@
<HintPath>..\..\packages\Microsoft.Net.Http.2.2.13\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll</HintPath>
</Reference>
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets"
Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets')"
Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion test/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<Import Project="..\Directory.Build.targets" />
<Import Project="..\packages\**\xunit.runner.msbuild.props" />
<Import Project="..\packages\xunit.runner.msbuild.2.3.1\**\xunit.runner.msbuild.props" />

<Target Name="Test" DependsOnTargets="_TestWithVSTest;_TestWithDotnetTest;_TestWithRunner" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,21 @@
<Analyzer Include="..\..\packages\xunit.analyzers.0.7.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets"
Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets')" />
<Import Project="..\..\packages\xunit.core.2.3.0\build\xunit.core.targets"
Condition="Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.props'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets')"
Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.8\tools\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.props')"
Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.props'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')"
Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')"
Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<Import Project="..\..\packages\xunit.core.2.3.0\build\xunit.core.targets" Condition="Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" />
</Project>
4 changes: 2 additions & 2 deletions tools/WebStack.StyleCop.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<StyleCopMsBuildRunner Include="$(WebStackRootPath)packages\**\StyleCop.dll"/>
<StyleCopAdditionalAddins Include="$(WebStackRootPath)packages\**\Microsoft.Web.StyleCop.dll" />
<StyleCopMsBuildRunner Include="$(WebStackRootPath)packages\StyleCop.5.0.0\**\StyleCop.dll"/>
<StyleCopAdditionalAddins Include="$(WebStackRootPath)packages\Microsoft.Web.SkipStrongNames.1.0.0\**\Microsoft.Web.StyleCop.dll" />
<StyleCopAdditionalAddinPaths Include="@(StyleCopAdditionalAddins -> '%(RootDir)%(Directory)')" />
</ItemGroup>

Expand Down
3 changes: 2 additions & 1 deletion tools/src/Microsoft.Web.FxCop/Microsoft.Web.FxCop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Web.FxCop</RootNamespace>
<AssemblyName>Microsoft.Web.FxCop</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<!-- May need to be updated as FxCopSdk.dll is migrated to newer TFMs. -->
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<OutputPath Condition=" '$(OutputPath)' == '' ">bin\$(Configuration)</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
Expand Down