Skip to content

Build samples on ci #566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@
Suppress warning for internal experimental APIs
-->
<NoWarn>$(NoWarn);SYSWEB1001</NoWarn>

<!-- We want to run pack on the solution so this allows us to do that -->
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>
</Project>
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project>
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Antlr" Version="3.5.0.2" />
<PackageVersion Include="AspNet.ScriptManager.bootstrap" Version="3.4.1" />
<PackageVersion Include="AspNet.ScriptManager.jQuery" Version="3.7.1" />
<PackageVersion Include="AspNet.ScriptManager.bootstrap" Version="5.2.3" />
<PackageVersion Include="AspNet.ScriptManager.jQuery" Version="3.7.0" />
<PackageVersion Include="AspNet.ScriptManager.jQuery.UI.Combined" Version="1.13.2" />
<PackageVersion Include="Autofac.Extras.Moq" Version="6.0.0" />
<PackageVersion Include="AutoFixture" Version="4.15.0" />
<PackageVersion Include="Basic.Reference.Assemblies" Version="1.4.5" />
<PackageVersion Include="bootstrap" Version="3.4.1" />
<PackageVersion Include="bootstrap" Version="5.2.3" />
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
<PackageVersion Include="jQuery" Version="3.7.1" />
<PackageVersion Include="jQuery" Version="3.7.0" />
<PackageVersion Include="jQuery.Validation" Version="1.19.5" />
<PackageVersion Include="Microsoft.AspNet.FriendlyUrls" Version="1.0.2" />
<PackageVersion Include="Microsoft.AspNet.Identity.EntityFramework" Version="2.2.3" />
Expand Down Expand Up @@ -82,4 +82,4 @@
<PackageVersion Include="WebGrease" Version="1.6.0" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.2.0" />
</ItemGroup>
</Project>
</Project>
5 changes: 4 additions & 1 deletion eng/Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Specify the solutions to build. Add all new solutions/projects here as necessary or the main build won't build them! -->
<ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<ProjectToBuild Include="$(MSBuildThisFileDirectory)..\Microsoft.AspNetCore.SystemWebAdapters.sln" />
</ItemGroup>
<ItemGroup Condition="!$([MSBuild]::IsOSPlatform('Windows'))">
<ProjectToBuild Include="$(MSBuildThisFileDirectory)..\Microsoft.AspNetCore.SystemWebAdapters.slnf" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
},
"msbuild-sdks": {
"MSBuild.SDK.SystemWeb": "4.0.88",
"MSBuild.SDK.SystemWeb": "4.0.93",
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24560.1"
}
}
5 changes: 5 additions & 0 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<VSToolsPath>$(MSBuildThisFileDirectory)targets</VSToolsPath>
<MvcBuildViews>false</MvcBuildViews>
</PropertyGroup>

<!-- When consuming the NuGet package, this is automatically added, but we must add it manually -->
<Import Project="$(MSBuildThisFileDirectory)../src/Microsoft.AspNetCore.SystemWebAdapters/Build/Microsoft.AspNetCore.SystemWebAdapters.props"/>

Expand Down
271 changes: 271 additions & 0 deletions samples/targets/WebApplications/Microsoft.WebApplication.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joperezr this is a targets file that is normally shipped with VS and the only blocker now for building the samples on CI. I do not know its license. Do you know how we can figure out if it's something we can distribute? If so, I'd want to push it upstream to the MSBuild.SDK.SystemWeb project after we get things working here.

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsDesktopBuild Condition="'$(IsDesktopBuild)'=='' And '$(TeamFoundationServerUrl)' != ''">False</IsDesktopBuild>
<WebProjectOutputDirInsideProjectDefault>True</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProjectDefault Condition="('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')" >False</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProject Condition="'$(WebProjectOutputDirInsideProject)' == ''">$(WebProjectOutputDirInsideProjectDefault)</WebProjectOutputDirInsideProject>
<DisableLinkInCopyWebApplicaton Condition="'$(DisableLinkInCopyWebApplicaton)'==''">False</DisableLinkInCopyWebApplicaton>
<Disable_CopyWebApplication Condition="'$(Disable_CopyWebApplication)' == ''">False</Disable_CopyWebApplication>
<UseWPP_CopyWebApplication Condition="'$(UseWPP_CopyWebApplication)' == ''">False</UseWPP_CopyWebApplication>
<CleanWebProjectOutputDir>True</CleanWebProjectOutputDir>
<CleanWebProjectOutputDir Condition="$(WebProjectOutputDirInsideProject)" >False</CleanWebProjectOutputDir>
</PropertyGroup>

<!--Only setup $(WebProjectOutputDir) iff user haven't set it up-->
<PropertyGroup Condition="'$(WebProjectOutputDir)'==''">
<WebProjectOutputDir>$(MSBuildProjectDirectory)</WebProjectOutputDir>
<WebProjectOutputDir Condition="!$(WebProjectOutputDirInsideProject)">$(OutDir)_PublishedWebsites\$(MSBuildProjectName)</WebProjectOutputDir>
</PropertyGroup>

<PropertyGroup>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
_CopyBinDeployableAssemblies;
</PrepareForRunDependsOn>
<PrepareForRunDependsOn Condition="!$(Disable_CopyWebApplication)">
$(PrepareForRunDependsOn);
_CopyWebApplication;
_BuiltWebOutputGroupOutput
</PrepareForRunDependsOn>
</PropertyGroup>

<!--***************************************************************-->
<!--Global setting for Clean target -->
<!--***************************************************************-->
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
CleanWebProjectOutputDir;
</CleanDependsOn>
</PropertyGroup>

<!--********************************************************************-->
<!-- CleanWebProjectOutputDir -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebProjectOutputDirDependsOn Condition="'$(CleanWebProjectOutputDirDependsOn)' == ''">
</CleanWebProjectOutputDirDependsOn>
</PropertyGroup>
<Target Name="CleanWebProjectOutputDir"
Condition="$(CleanWebProjectOutputDir)"
DependsOnTargets="$(CleanWebProjectOutputDirDependsOn)">
<!--Assertion check-->
<!--In the case of Clean Packaging/Publish, we simply delete the WebProjectOutputDir-->
<RemoveDir Condition="Exists($(WebProjectOutputDir))" Directories="$(WebProjectOutputDir)" ContinueOnError="true" />
</Target>

<!--
============================================================
_CopyWebApplication

This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.

This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.

The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true.
By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation.
============================================================
-->

<PropertyGroup>
<!--This will be overwrite by ..\web\Microsoft.Web.Publishing.targets when $(UseWPP_CopyWebApplication) set to true-->
<OnBefore_CopyWebApplicationDefault>
_CopyWebApplicationLegacy;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplicationDefault Condition="$(UseWPP_CopyWebApplication) AND Exists('$(MSBuildThisFileDirectory)\..\Web\Microsoft.Web.Publishing.targets')">
_WPPCopyWebApplication;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplication Condition="'$(OnBefore_CopyWebApplication)'==''">
$(OnBefore_CopyWebApplicationDefault);
</OnBefore_CopyWebApplication>

<OnAfter_CopyWebApplication Condition="'$(OnAfter_CopyWebApplication)'==''">
</OnAfter_CopyWebApplication>

<_CopyWebApplicationDependsOn Condition="'$(_CopyWebApplicationDependsOn)'==''">
$(OnBefore_CopyWebApplication);
</_CopyWebApplicationDependsOn>

</PropertyGroup>
<Target Name="_CopyWebApplication"
Condition="!$(Disable_CopyWebApplication) And !$(WebProjectOutputDirInsideProject)"
DependsOnTargets="$(_CopyWebApplicationDependsOn)">

<CallTarget Condition="'$(OnAfter_CopyWebApplication)' != ''" Targets="$(OnAfter_CopyWebApplication)" RunEachTargetSeparately="true" />

</Target>

<!--
============================================================
_CopyWebApplicationLegacy

This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.

This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
============================================================
-->
<Target Name="_CopyWebApplicationLegacy" Condition="!$(Disable_CopyWebApplication) And !$(WebProjectOutputDirInsideProject)" >
<!-- Log tasks -->
<Message Text="Copying Web Application Project Files for $(MSBuildProjectName)" />

<!-- Create the _PublishedWebsites\app\bin folder -->
<MakeDir Directories="$(WebProjectOutputDir)\bin" />

<!-- Copy build outputs to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(AddModules)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)"
DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)"
SkipUnchangedFiles="true"
Condition="'$(_SGenDllCreated)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DebugSymbolsProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(DocFileItem)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DocumentationFileProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)"
DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

<!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(ReferenceCopyLocalPaths)"
DestinationFiles="@(ReferenceCopyLocalPaths->'$(WebProjectOutputDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

<!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
<Copy SourceFiles="@(Content)" Condition="'%(Content.Link)' == ''"
DestinationFiles="@(Content -> '$(WebProjectOutputDir)\%(RelativeDir)\%(FileName)%(Extension)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
<Copy SourceFiles="@(Content)" Condition="!$(DisableLinkInCopyWebApplicaton) And '%(Content.Link)' != ''"
DestinationFiles="@(Content -> '$(WebProjectOutputDir)\%(Link)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

<!-- Copy items that have been marked to be copied to the bin folder -->
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectory)"
DestinationFiles="@(_SourceItemsToCopyToOutputDirectory-> '$(WebProjectOutputDir)\bin\%(TargetPath)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectoryAlways)"
DestinationFiles="@(_SourceItemsToCopyToOutputDirectoryAlways-> '$(WebProjectOutputDir)\bin\%(TargetPath)')"
SkipUnchangedFiles="false"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

<!-- Copy items that need to be bin deployed to the bin folder -->
<Copy SourceFiles="@(_binDeployableAssemblies)"
DestinationFolder="$(WebProjectOutputDir)\bin\%(_binDeployableAssemblies.DestinationRelPath)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

</Target>

<!--
============================================================
_BuiltWebOutputGroupOutput

This target creates and populates BuiltWebOutputGroupOutput
with contents of bin along with the @(Content) files
============================================================
-->
<Target Name ="_BuiltWebOutputGroupOutput"
Condition="!$(Disable_CopyWebApplication)"
Outputs="@(BuiltWebOutputGroupOutput)">
<CreateItem Include="$(WebProjectOutputDir)\bin\**\*.*;@(Content->'%(FullPath)')" Condition="'$(OutDir)' == '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>

<CreateItem Include="$(WebProjectOutputDir)\**\*.*" Condition="'$(OutDir)' != '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
</Target>

<!--
============================================================
_CopyBinDeployableAssemblies

This target copies the contents of ProjectDir\_bin_deployableAssemblies to the bin
folder, preserving the relative paths
============================================================
-->
<Target
Name="_CopyBinDeployableAssemblies"
Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">

<PropertyGroup>
<BinDeployableFolder Condition="'$(BinDeployableFolder)' == ''">_bin_deployableAssemblies\</BinDeployableFolder>
<BinDeployableFolderFullPath>$([System.IO.Path]::GetFullPath($(BinDeployableFolder)))</BinDeployableFolderFullPath>
</PropertyGroup>

<!--Pick up the deployable items from the $(None) collection that are under the _bin_deployableAssemblies folder -->
<CreateItem Include="@(None->'%(Identity)')" Condition="'%(None.FullPath)' != '' And $([System.String]::new('%(None.FullPath)').StartsWith($(BinDeployableFolderFullPath), StringComparison.OrdinalIgnoreCase ))" >
<Output ItemName="__binDeployableAssemblies" TaskParameter="Include"/>
</CreateItem>

<!--Add metadata which holds the destination relative folder to copy them to-->
<ItemGroup>
<_binDeployableAssemblies Include ="@(__binDeployableAssemblies)" Condition="'@(__binDeployableAssemblies)' != ''">
<DestinationRelPath>$([System.String]::Concat($([System.IO.Path]::GetDirectoryName($([System.String]::new('%(__binDeployableAssemblies.FullPath)')))),'\').SubString($(BinDeployableFolderFullPath.Length)))</DestinationRelPath>
</_binDeployableAssemblies>
</ItemGroup>

<!-- Do the copy-->
<Copy SourceFiles="@(_binDeployableAssemblies)" DestinationFolder="$(OutDir)%(_binDeployableAssemblies.DestinationRelPath)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>

<!--Add the items just copied to the collection of items to delete when doing a clean-->
<ItemGroup>
<FileWrites Include ="@(_binDeployableAssemblies->'$(OutDir)%(DestinationRelPath)%(Filename)%(Extension)')" />
</ItemGroup>
</Target>

<!--Import publishing target-->
<PropertyGroup>
<AspNetTargetsPath Condition=" '$(AspNetTargetsPath)'=='' ">$(MSBuildThisFileDirectory)..\Web\</AspNetTargetsPath>
</PropertyGroup>

<Import Project="$(AspNetTargetsPath)Microsoft.Web.Publishing.targets" Condition="Exists('$(AspNetTargetsPath)Microsoft.Web.Publishing.targets')" />

<!-- Instruct ResolveAssemblyReferences in MS.Common.targets to generate suggested binding redirects. -->
<PropertyGroup>
<AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences>
<AppConfig Condition="'$(AppConfig)' == '' And Exists('$(ProjectConfigFileName)')">$(ProjectConfigFileName)</AppConfig>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public void ContentFilesCopied()
// Arrange
var expected = new[]
{
Path.Combine("Scripts", "jquery-3.7.1-vsdoc.js"),
Path.Combine("Scripts", "jquery-3.7.1.js"),
Path.Combine("Scripts", "jquery-3.7.1.min.js"),
Path.Combine("Scripts", "jquery-3.7.1.min.map"),
Path.Combine("Scripts", "jquery-3.7.1.slim.js"),
Path.Combine("Scripts", "jquery-3.7.1.slim.min.js"),
Path.Combine("Scripts", "jquery-3.7.1.slim.min.map"),
Path.Combine("Scripts", "jquery-3.7.0-vsdoc.js"),
Path.Combine("Scripts", "jquery-3.7.0.js"),
Path.Combine("Scripts", "jquery-3.7.0.min.js"),
Path.Combine("Scripts", "jquery-3.7.0.min.map"),
Path.Combine("Scripts", "jquery-3.7.0.slim.js"),
Path.Combine("Scripts", "jquery-3.7.0.slim.min.js"),
Path.Combine("Scripts", "jquery-3.7.0.slim.min.map"),
};

// Act
Expand Down