diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
index aa0a8da485..4d60b543ae 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props
@@ -42,14 +42,6 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
false
-
- false
-
.g.cs
+
true
+
+
+ false
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets
index e148904829..ffb77fce72 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.targets
@@ -174,8 +174,14 @@ Copyright (c) .NET Foundation. All rights reserved.
false
true
- false
- true
+
+ $(CopyRefAssembliesToPublishDirectory)
+
+ false
+ true
+
+
+ true
+
+
@@ -711,21 +727,6 @@ Copyright (c) .NET Foundation. All rights reserved.
-
-
-
-
-
-
-
l.Name == "Microsoft.NETCore.App");
+ var packageReference = dependencyContext.CompileLibraries.First(l => l.Name == "System.Diagnostics.DiagnosticSource");
Assert.NotEmpty(packageReference.Assemblies);
var projectReference = dependencyContext.CompileLibraries.First(l => l.Name == "SimpleMvc");
Assert.NotEmpty(projectReference.Assemblies);
Assert.Contains(customDefine, dependencyContext.CompilationOptions.Defines);
+
+ // Verify no refs folder is produced
+ Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
}
[Fact]
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest21.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest21.cs
index ee221c6022..061399ddfc 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest21.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest21.cs
@@ -37,5 +37,25 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Path.Combine(IntermediateOutputPath, "SimpleMvc21.TagHelpers.output.cache"),
@"""Name"":""SimpleMvc.SimpleTagHelper""");
}
+
+ [Fact]
+ [InitializeTestProject("SimpleMvc21")]
+ public async Task Publish_NETCoreApp21TargetingProject()
+ {
+ TargetFramework = "netcoreapp2.1";
+
+ var result = await DotnetMSBuild("Publish");
+
+ Assert.BuildPassed(result);
+
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.dll");
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.pdb");
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.Views.dll");
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc21.Views.pdb");
+
+ // By default refs and .cshtml files will not be copied on publish
+ Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
+ Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
+ }
}
}
diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs
index 7734f7dc16..52a0582328 100644
--- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs
+++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs
@@ -247,6 +247,30 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
}
+ [Fact]
+ [InitializeTestProject("SimpleMvc")]
+ public async Task Publish_WithCopySettingsInProjectFile_CopiesFiles()
+ {
+ AddProjectFileContent(@"
+
+ true
+ true
+ ");
+
+ var result = await DotnetMSBuild("Publish");
+
+ Assert.BuildPassed(result);
+
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc.dll");
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb");
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.dll");
+ Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.pdb");
+
+ // By default refs and .cshtml files will not be copied on publish
+ Assert.FileExists(result, PublishOutputPath, "refs", "mscorlib.dll");
+ Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
+ }
+
[Fact] // Tests old MvcPrecompilation behavior that we support for compat.
[InitializeTestProject("SimpleMvc")]
public async Task Publish_MvcRazorExcludeFilesFromPublish_False_CopiesFiles()
diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj
index 8cf7f123d1..b061917f3c 100644
--- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj
+++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Microsoft.AspNetCore.Razor.Test.Common.csproj
@@ -4,7 +4,7 @@
$(DefineConstants);GENERATE_BASELINES
$(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES
- netstandard2.0
+ netstandard2.0;net461
diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs
index a3ae5fbed3..920fd2566e 100644
--- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs
+++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs
@@ -32,6 +32,7 @@ namespace Microsoft.CodeAnalysis
private static IEnumerable ResolvePaths(CompilationLibrary library)
{
+#if NETFRAMEWORK
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
for (var i = 0; i < assemblies.Length; i++)
{
@@ -40,6 +41,7 @@ namespace Microsoft.CodeAnalysis
return new[] { assemblies[i].Location };
}
}
+#endif
try
{
diff --git a/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj b/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj
index bbd86a5772..9386f89689 100644
--- a/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj
+++ b/src/Razor/test/testassets/AppWithP2PReference/AppWithP2PReference.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/src/Razor/test/testassets/LargeProject/LargeProject.csproj b/src/Razor/test/testassets/LargeProject/LargeProject.csproj
index 0581e93450..8e8dea1809 100644
--- a/src/Razor/test/testassets/LargeProject/LargeProject.csproj
+++ b/src/Razor/test/testassets/LargeProject/LargeProject.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj b/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj
index d89f94bc3e..523061d189 100644
--- a/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj
+++ b/src/Razor/test/testassets/MvcWithComponents/MvcWithComponents.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj b/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj
index 12fca67a75..21ed48c476 100644
--- a/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj
+++ b/src/Razor/test/testassets/SimpleMvc/SimpleMvc.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj b/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj
index 4edd0713ca..e9a2f2c754 100644
--- a/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj
+++ b/src/Razor/test/testassets/SimpleMvcFSharp/SimpleMvcFSharp.fsproj
@@ -20,7 +20,7 @@
-
+
diff --git a/src/Razor/test/testassets/SimplePages/SimplePages.csproj b/src/Razor/test/testassets/SimplePages/SimplePages.csproj
index 858eeeb71e..66d48660f4 100644
--- a/src/Razor/test/testassets/SimplePages/SimplePages.csproj
+++ b/src/Razor/test/testassets/SimplePages/SimplePages.csproj
@@ -15,7 +15,7 @@
-
+