[StaticWebAssets][Fixes #AspNetCore/17426] Publish no build doesn't copy static web assets from referenced projects
\n\nCommit migrated from 6685cd6105
This commit is contained in:
parent
9328e4723e
commit
3ff767b3d3
|
|
@ -54,23 +54,19 @@ Copyright (c) .NET Foundation. All rights reserved.
|
|||
$(GetCurrentProjectStaticWebAssetsDependsOn)
|
||||
</GetCurrentProjectStaticWebAssetsDependsOn>
|
||||
|
||||
<AssignTargetPathsDependsOn>
|
||||
<GetCopyToOutputDirectoryItemsDependsOn>
|
||||
$(GetCopyToOutputDirectoryItemsDependsOn);
|
||||
GenerateStaticWebAssetsManifest;
|
||||
$(AssignTargetPathsDependsOn)
|
||||
</AssignTargetPathsDependsOn>
|
||||
</GetCopyToOutputDirectoryItemsDependsOn>
|
||||
|
||||
<ResolveStaticWebAssetsInputsDependsOn>
|
||||
ResolveCurrentProjectStaticWebAssetsInputs;
|
||||
$(ResolveStaticWebAssetsInputsDependsOn)
|
||||
</ResolveStaticWebAssetsInputsDependsOn>
|
||||
|
||||
<ResolveStaticWebAssetsInputsDependsOn Condition="$(NoBuild) != 'true'">
|
||||
ResolveReferencedProjectsStaticWebAssets;
|
||||
$(ResolveStaticWebAssetsInputsDependsOn)
|
||||
</ResolveStaticWebAssetsInputsDependsOn>
|
||||
|
||||
<ResolveReferencedProjectsStaticWebAssetsDependsOn>
|
||||
ResolveReferences;
|
||||
PrepareProjectReferences;
|
||||
$(ResolveReferencedProjectsStaticWebAssetsDependsOn)
|
||||
</ResolveReferencedProjectsStaticWebAssetsDependsOn>
|
||||
|
||||
|
|
@ -187,14 +183,14 @@ Copyright (c) .NET Foundation. All rights reserved.
|
|||
|
||||
<!-- This is the list of inputs that will be used for generating the manifest used during development. -->
|
||||
<ItemGroup>
|
||||
<Content
|
||||
<ContentWithTargetPath
|
||||
Include="$(_GeneratedStaticWebAssetsDevelopmentManifest)"
|
||||
Condition="'@(_ExternalStaticWebAsset->Count())' != '0'"
|
||||
Link="$(TargetName).StaticWebAssets.xml">
|
||||
Condition="'@(_ExternalStaticWebAsset->Count())' != '0'">
|
||||
|
||||
<TargetPath>$(TargetName).StaticWebAssets.xml</TargetPath>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ContentWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -104,6 +104,26 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "PackageLibraryTransitiveDependency", "js", "pkg-transitive-dep.js"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[InitializeTestProject("AppWithPackageAndP2PReference", additionalProjects: new[] { "ClassLibrary", "ClassLibrary2" })]
|
||||
public async Task Publish_NoBuild_CopiesStaticWebAssetsToDestinationFolder()
|
||||
{
|
||||
var build = await DotnetMSBuild("Build", "/restore");
|
||||
|
||||
Assert.BuildPassed(build);
|
||||
|
||||
var publish = await DotnetMSBuild("Publish", "/p:NoBuild=true");
|
||||
|
||||
Assert.BuildPassed(publish);
|
||||
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "ClassLibrary", "js", "project-transitive-dep.js"));
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "ClassLibrary", "js", "project-transitive-dep.v4.js"));
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "ClassLibrary2", "css", "site.css"));
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "ClassLibrary2", "js", "project-direct-dep.js"));
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "PackageLibraryDirectDependency", "css", "site.css"));
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "PackageLibraryDirectDependency", "js", "pkg-direct-dep.js"));
|
||||
Assert.FileExists(publish, PublishOutputPath, Path.Combine("wwwroot", "_content", "PackageLibraryTransitiveDependency", "js", "pkg-transitive-dep.js"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[InitializeTestProject("SimpleMvc")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue