diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs
index 1bc76c5745..b69109869b 100644
--- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs
+++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/MSBuildIntegrationTestBase.cs
@@ -61,6 +61,18 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
msBuildProcessKind);
}
+ internal void AddProjectFileContent(string content)
+ {
+ if (content == null)
+ {
+ throw new ArgumentNullException(nameof(content));
+ }
+
+ var existing = File.ReadAllText(Project.ProjectFilePath);
+ var updated = existing.Replace("", content);
+ File.WriteAllText(Project.ProjectFilePath, updated);
+ }
+
internal void ReplaceContent(string content, params string[] paths)
{
if (content == null)
diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs
index c9d2ab4a14..920457e279 100644
--- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs
+++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/ProjectDirectory.cs
@@ -57,7 +57,10 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
CopyGlobalJson(solutionRoot, destinationPath);
- return new ProjectDirectory(destinationPath, Path.Combine(destinationPath, projectName));
+ return new ProjectDirectory(
+ destinationPath,
+ Path.Combine(destinationPath, projectName),
+ Path.Combine(destinationPath, projectName, projectName + ".csproj"));
}
catch
{
@@ -119,14 +122,17 @@ $@"
}
}
- private ProjectDirectory(string solutionPath, string directoryPath)
+ private ProjectDirectory(string solutionPath, string directoryPath, string projectFilePath)
{
SolutionPath = solutionPath;
DirectoryPath = directoryPath;
+ ProjectFilePath = projectFilePath;
}
public string DirectoryPath { get; }
+ public string ProjectFilePath { get;}
+
public string SolutionPath { get; }
public void Dispose()
diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs
index 97a4615546..ae6899a613 100644
--- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs
+++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/RazorGenerateIntegrationTest.cs
@@ -244,5 +244,37 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "About.cs");
Assert.FileCountEquals(result, 1, RazorIntermediateOutputPath, "*.cs");
}
+
+ [Fact(Skip = "Fails due to #1999")]
+ [InitializeTestProject("SimpleMvc")]
+ public async Task RazorGenerate_FileWithAbsolutePath_IgnoresFile()
+ {
+ // In preview1 we totally ignore files that are specified with an absolute path
+ var filePath = Path.Combine(Project.SolutionPath, "temp.cshtml");
+ File.WriteAllText(filePath, string.Empty);
+
+ AddProjectFileContent($@"
+
+
+");
+
+ var result = await DotnetMSBuild(RazorGenerateTarget);
+
+ Assert.BuildPassed(result);
+
+ // RazorGenerate should compile the assembly, but not the views.
+ Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.dll");
+ Assert.FileDoesNotExist(result, IntermediateOutputPath, "SimpleMvc.PrecompiledViews.dll");
+
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "_ViewImports.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "_ViewStart.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "About.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "Contact.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Home", "Index.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Shared", "_Layout.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Shared", "_ValidationScriptsPartial.cs");
+ Assert.FileExists(result, RazorIntermediateOutputPath, "Views", "Shared", "Error.cs");
+ Assert.FileCountEquals(result, 8, RazorIntermediateOutputPath, "*.cs");
+ }
}
}
diff --git a/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj b/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj
index a1090fca82..8b35af4413 100644
--- a/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj
+++ b/test/testapps/AppWithP2PReference/AppWithP2PReference.csproj
@@ -13,6 +13,8 @@
RazorSDK
+
+
diff --git a/test/testapps/ClassLibrary/ClassLibrary.csproj b/test/testapps/ClassLibrary/ClassLibrary.csproj
index 21588daae9..cc24521d0c 100644
--- a/test/testapps/ClassLibrary/ClassLibrary.csproj
+++ b/test/testapps/ClassLibrary/ClassLibrary.csproj
@@ -13,6 +13,8 @@
RazorSDK
+
+
false
diff --git a/test/testapps/SimpleMvc/SimpleMvc.csproj b/test/testapps/SimpleMvc/SimpleMvc.csproj
index caddabdab8..0a1e15bfad 100644
--- a/test/testapps/SimpleMvc/SimpleMvc.csproj
+++ b/test/testapps/SimpleMvc/SimpleMvc.csproj
@@ -12,4 +12,7 @@
RazorSDK
+
+
+
diff --git a/test/testapps/SimplePages/SimplePages.csproj b/test/testapps/SimplePages/SimplePages.csproj
index caddabdab8..0a1e15bfad 100644
--- a/test/testapps/SimplePages/SimplePages.csproj
+++ b/test/testapps/SimplePages/SimplePages.csproj
@@ -12,4 +12,7 @@
RazorSDK
+
+
+