Add support and tests for Pack and P2P reference
This commit is contained in:
parent
34954c3668
commit
bb0aa9464a
|
|
@ -7,6 +7,7 @@
|
||||||
<_RazorDebugSymbolsIntermediatePath
|
<_RazorDebugSymbolsIntermediatePath
|
||||||
Condition="'$(DebugSymbols)'=='true' and '$(DebugType)'!='' and '$(DebugType)'!='none' and '$(DebugType)'!='embedded'"
|
Condition="'$(DebugSymbols)'=='true' and '$(DebugType)'!='' and '$(DebugType)'!='none' and '$(DebugType)'!='embedded'"
|
||||||
Include="$(IntermediateOutputPath)$(RazorTargetName).pdb" />
|
Include="$(IntermediateOutputPath)$(RazorTargetName).pdb" />
|
||||||
|
<_RazorDebugSymbolsOutputPath Include="@(_RazorDebugSymbolsIntermediatePath->'$(OutDir)%(Filename)%(Extension)')" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(RazorCompileOnBuild)'=='true'">
|
<PropertyGroup Condition="'$(RazorCompileOnBuild)'=='true'">
|
||||||
<PrepareForRunDependsOn>RazorCompile;$(PrepareForRunDependsOn)</PrepareForRunDependsOn>
|
<PrepareForRunDependsOn>RazorCompile;$(PrepareForRunDependsOn);_RazorCopyFilesToOutputDirectory</PrepareForRunDependsOn>
|
||||||
|
<GetCopyToOutputDirectoryItemsDependsOn>$(GetCopyToOutputDirectoryItemsDependsOn);_RazorGetCopyToOutputDirectoryItems</GetCopyToOutputDirectoryItemsDependsOn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
@ -141,7 +142,26 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="_RazorCopyFilesToOutputDirectory" AfterTargets="CopyFilesToOutputDirectory">
|
<Target Name="_RazorAddBuiltProjectOutputGroupOutput" Condition="'$(RazorCompileOnBuild)' == 'true'" BeforeTargets="BuiltProjectOutputGroup">
|
||||||
|
<ItemGroup>
|
||||||
|
<BuiltProjectOutputGroupOutput Include="@(RazorIntermediateAssembly)" FinalOutputPath="$(Outdir)$(RazorTargetName).dll" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RazorGetCopyToOutputDirectoryItems">
|
||||||
|
<ItemGroup>
|
||||||
|
<AllItemsFullPathWithTargetPath Include="@(RazorIntermediateAssembly->'%(FullPath)')">
|
||||||
|
<TargetPath>%(Filename)%(Extension)</TargetPath>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</AllItemsFullPathWithTargetPath>
|
||||||
|
<AllItemsFullPathWithTargetPath Include="@(_RazorDebugSymbolsIntermediatePath->'%(FullPath)')">
|
||||||
|
<TargetPath>%(Filename)%(Extension)</TargetPath>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</AllItemsFullPathWithTargetPath>
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_RazorCopyFilesToOutputDirectory">
|
||||||
|
|
||||||
<!-- Copy the Razor dll -->
|
<!-- Copy the Razor dll -->
|
||||||
<Copy
|
<Copy
|
||||||
|
|
@ -166,8 +186,8 @@
|
||||||
|
|
||||||
<!-- Copy the Razor debug information file (.pdb), if any -->
|
<!-- Copy the Razor debug information file (.pdb), if any -->
|
||||||
<Copy
|
<Copy
|
||||||
SourceFiles="$(_RazorDebugSymbolsIntermediatePath)"
|
SourceFiles="@(_RazorDebugSymbolsIntermediatePath)"
|
||||||
DestinationFiles="@(_DebugSymbolsOutputPath)"
|
DestinationFiles="@(_RazorDebugSymbolsOutputPath)"
|
||||||
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
|
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
|
||||||
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
|
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
|
||||||
Retries="$(CopyRetryCount)"
|
Retries="$(CopyRetryCount)"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
@ -153,6 +154,62 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void NuspecContains(MSBuildResult result, string nuspecPath, string expected)
|
||||||
|
{
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nuspecPath == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(nuspecPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expected == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
nuspecPath = Path.Combine(result.Project.DirectoryPath, nuspecPath);
|
||||||
|
FileExists(result, nuspecPath);
|
||||||
|
|
||||||
|
var content = File.ReadAllText(nuspecPath);
|
||||||
|
if (!content.Contains(expected))
|
||||||
|
{
|
||||||
|
throw new NuspecException(result, nuspecPath, content, expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void NupkgContains(MSBuildResult result, string nupkgPath, string filePath)
|
||||||
|
{
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nupkgPath == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(nupkgPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filePath == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(filePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
nupkgPath = Path.Combine(result.Project.DirectoryPath, nupkgPath);
|
||||||
|
FileExists(result, nupkgPath);
|
||||||
|
|
||||||
|
var unzipped = Path.Combine(result.Project.DirectoryPath, "nupkg");
|
||||||
|
ZipFile.ExtractToDirectory(nupkgPath, unzipped);
|
||||||
|
|
||||||
|
if (!File.Exists(Path.Combine(unzipped, filePath)))
|
||||||
|
{
|
||||||
|
throw new NupkgFileMissingException(result, nupkgPath, filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private abstract class MSBuildXunitException : Xunit.Sdk.XunitException
|
private abstract class MSBuildXunitException : Xunit.Sdk.XunitException
|
||||||
{
|
{
|
||||||
protected MSBuildXunitException(MSBuildResult result)
|
protected MSBuildXunitException(MSBuildResult result)
|
||||||
|
|
@ -297,5 +354,51 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
|
|
||||||
protected override string Heading => $"File: '{FilePath}' was found, but should not exist.";
|
protected override string Heading => $"File: '{FilePath}' was found, but should not exist.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class NuspecException : MSBuildXunitException
|
||||||
|
{
|
||||||
|
public NuspecException(MSBuildResult result, string filePath, string content, string expected)
|
||||||
|
: base(result)
|
||||||
|
{
|
||||||
|
FilePath = filePath;
|
||||||
|
Content = content;
|
||||||
|
Expected = expected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Content { get; }
|
||||||
|
|
||||||
|
public string Expected { get; }
|
||||||
|
|
||||||
|
public string FilePath { get; }
|
||||||
|
|
||||||
|
protected override string Heading
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return
|
||||||
|
$"nuspec: '{FilePath}' did not contain the expected content." + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
$"expected: {Expected}" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
$"actual: {Content}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NupkgFileMissingException : MSBuildXunitException
|
||||||
|
{
|
||||||
|
public NupkgFileMissingException(MSBuildResult result, string nupkgPath, string filePath)
|
||||||
|
: base(result)
|
||||||
|
{
|
||||||
|
NupkgPath = nupkgPath;
|
||||||
|
FilePath = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string FilePath { get; }
|
||||||
|
|
||||||
|
public string NupkgPath { get; }
|
||||||
|
|
||||||
|
protected override string Heading => $"File: '{FilePath}' was not found was not found in {NupkgPath}.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
|
|
||||||
Assert.BuildPassed(result);
|
Assert.BuildPassed(result);
|
||||||
Assert.FileExists(result, OutputPath, "SimpleMvc.dll");
|
Assert.FileExists(result, OutputPath, "SimpleMvc.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "SimpleMvc.pdb");
|
||||||
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.dll");
|
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb");
|
||||||
|
|
||||||
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Darwin)
|
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Darwin)
|
||||||
{
|
{
|
||||||
|
|
@ -114,5 +116,18 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.pdb");
|
Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.pdb");
|
||||||
Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb");
|
Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[InitializeTestProject("AppWithP2PReference", "ClassLibrary")]
|
||||||
|
public async Task Build_WithP2P_CopiesRazorAssembly()
|
||||||
|
{
|
||||||
|
var result = await DotnetMSBuild("Build", "/p:RazorCompileOnBuild=true");
|
||||||
|
|
||||||
|
Assert.BuildPassed(result);
|
||||||
|
Assert.FileExists(result, OutputPath, "AppWithP2PReference.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "AppWithP2PReference.PrecompiledViews.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "ClassLibrary.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "ClassLibrary.PrecompiledViews.dll");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
public class InitializeTestProjectAttribute : BeforeAfterTestAttribute
|
public class InitializeTestProjectAttribute : BeforeAfterTestAttribute
|
||||||
{
|
{
|
||||||
private readonly string _projectName;
|
private readonly string _projectName;
|
||||||
|
private readonly string[] _additionalProjects;
|
||||||
|
|
||||||
public InitializeTestProjectAttribute(string projectName)
|
public InitializeTestProjectAttribute(string projectName, params string[] additionalProjects)
|
||||||
{
|
{
|
||||||
_projectName = projectName;
|
_projectName = projectName;
|
||||||
|
_additionalProjects = additionalProjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Before(MethodInfo methodUnderTest)
|
public override void Before(MethodInfo methodUnderTest)
|
||||||
|
|
@ -23,7 +25,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
throw new InvalidOperationException($"This should be used on a class derived from {typeof(MSBuildIntegrationTestBase)}");
|
throw new InvalidOperationException($"This should be used on a class derived from {typeof(MSBuildIntegrationTestBase)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_projectName);
|
MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_projectName, _additionalProjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void After(MethodInfo methodUnderTest)
|
public override void After(MethodInfo methodUnderTest)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
|
{
|
||||||
|
public class PackIntegrationTest : MSBuildIntegrationTestBase
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
[InitializeTestProject("ClassLibrary")]
|
||||||
|
public async Task Pack_Wortks_IncludesRazorAssembly()
|
||||||
|
{
|
||||||
|
var result = await DotnetMSBuild("Pack", "/p:RazorCompileOnBuild=true");
|
||||||
|
|
||||||
|
Assert.BuildPassed(result);
|
||||||
|
|
||||||
|
Assert.FileExists(result, OutputPath, "ClassLibrary.dll");
|
||||||
|
Assert.FileExists(result, OutputPath, "ClassLibrary.PrecompiledViews.dll");
|
||||||
|
|
||||||
|
Assert.NuspecContains(
|
||||||
|
result,
|
||||||
|
Path.Combine("obj", Configuration, "ClassLibrary.1.0.0.nuspec"),
|
||||||
|
$"<file src=\"{Path.Combine("bin", Configuration, "netcoreapp2.0", "ClassLibrary.PrecompiledViews.dll")}\" " +
|
||||||
|
$"target=\"{Path.Combine("lib", "netcoreapp2.0", "ClassLibrary.PrecompiledViews.dll")}\" />");
|
||||||
|
|
||||||
|
Assert.NupkgContains(
|
||||||
|
result,
|
||||||
|
Path.Combine("bin", Configuration, "ClassLibrary.1.0.0.nupkg"),
|
||||||
|
Path.Combine("lib", "netcoreapp2.0", "ClassLibrary.PrecompiledViews.dll"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
public bool PreserveWorkingDirectory { get; set; }
|
public bool PreserveWorkingDirectory { get; set; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static ProjectDirectory Create(string projectName)
|
public static ProjectDirectory Create(string projectName, string[] additionalProjects)
|
||||||
{
|
{
|
||||||
var destinationPath = Path.Combine(Path.GetTempPath(), "Razor", Path.GetRandomFileName());
|
var destinationPath = Path.Combine(Path.GetTempPath(), "Razor", Path.GetRandomFileName());
|
||||||
Directory.CreateDirectory(destinationPath);
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
|
@ -38,21 +38,26 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
throw new InvalidOperationException("Could not find solution root.");
|
throw new InvalidOperationException("Could not find solution root.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var projectRoot = Path.Combine(solutionRoot, "test", "testapps", projectName);
|
|
||||||
if (!Directory.Exists(projectRoot))
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"Could not find project at '{projectRoot}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
var binariesRoot = Path.GetDirectoryName(typeof(ProjectDirectory).Assembly.Location);
|
var binariesRoot = Path.GetDirectoryName(typeof(ProjectDirectory).Assembly.Location);
|
||||||
|
|
||||||
CopyDirectory(new DirectoryInfo(projectRoot), new DirectoryInfo(destinationPath));
|
foreach (var project in new string[] { projectName, }.Concat(additionalProjects))
|
||||||
|
{
|
||||||
|
var projectRoot = Path.Combine(solutionRoot, "test", "testapps", project);
|
||||||
|
if (!Directory.Exists(projectRoot))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Could not find project at '{projectRoot}'");
|
||||||
|
}
|
||||||
|
|
||||||
CreateDirectoryProps(projectRoot, binariesRoot, destinationPath);
|
var projectDestination = Path.Combine(destinationPath, project);
|
||||||
CreateDirectoryTargets(destinationPath);
|
Directory.CreateDirectory(projectDestination);
|
||||||
|
CopyDirectory(new DirectoryInfo(projectRoot), new DirectoryInfo(projectDestination));
|
||||||
|
CreateDirectoryProps(projectRoot, binariesRoot, destinationPath);
|
||||||
|
CreateDirectoryTargets(destinationPath);
|
||||||
|
}
|
||||||
|
|
||||||
CopyGlobalJson(solutionRoot, destinationPath);
|
CopyGlobalJson(solutionRoot, destinationPath);
|
||||||
|
|
||||||
return new ProjectDirectory(destinationPath);
|
return new ProjectDirectory(destinationPath, Path.Combine(destinationPath, projectName));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -127,22 +132,25 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectDirectory(string directoryPath)
|
private ProjectDirectory(string solutionPath, string directoryPath)
|
||||||
{
|
{
|
||||||
|
SolutionPath = solutionPath;
|
||||||
DirectoryPath = directoryPath;
|
DirectoryPath = directoryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DirectoryPath { get; }
|
public string DirectoryPath { get; }
|
||||||
|
|
||||||
|
public string SolutionPath { get; }
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (PreserveWorkingDirectory)
|
if (PreserveWorkingDirectory)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Skipping deletion of working directory {DirectoryPath}");
|
Console.WriteLine($"Skipping deletion of working directory {SolutionPath}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CleanupDirectory(DirectoryPath);
|
CleanupDirectory(SolutionPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ClassLibrary\ClassLibrary.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||||
|
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||||
|
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj"/>
|
||||||
|
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
|
<Reference Include="$(BinariesRoot)\System.Diagnostics.DiagnosticSource.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Runtime.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.dll"/>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace AppWithP2PReference.Models
|
||||||
|
{
|
||||||
|
public class ErrorViewModel
|
||||||
|
{
|
||||||
|
public string RequestId { get; set; }
|
||||||
|
|
||||||
|
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
namespace AppWithP2PReference
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// Just make sure we have a reference to the MvcShim
|
||||||
|
var t = typeof(Microsoft.AspNetCore.Mvc.IActionResult);
|
||||||
|
System.Console.WriteLine(t.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "About";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"]</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<p>Use this area to provide additional information.</p>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Contact";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"]</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
One Microsoft Way<br />
|
||||||
|
Redmond, WA 98052-6399<br />
|
||||||
|
<abbr title="Phone">P:</abbr>
|
||||||
|
425.555.0100
|
||||||
|
</address>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||||
|
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||||
|
</address>
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||||
|
<ol class="carousel-indicators">
|
||||||
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="3"></li>
|
||||||
|
</ol>
|
||||||
|
<div class="carousel-inner" role="listbox">
|
||||||
|
<div class="item active">
|
||||||
|
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how to build ASP.NET apps that can run anywhere.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
There are powerful new features in Visual Studio for building modern web apps.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner3.svg" alt="Package Management" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
|
||||||
|
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||||
|
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||||
|
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Application uses</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Sample pages using ASP.NET Core MVC</li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
|
||||||
|
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>How to</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Overview</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Run & Deploy</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||||
|
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
@model ErrorViewModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
@if (Model.ShowRequestId)
|
||||||
|
{
|
||||||
|
<p>
|
||||||
|
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||||
|
</p>
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<environment include="Development">
|
||||||
|
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||||
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||||
|
</environment>
|
||||||
|
<environment exclude="Development">
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k">
|
||||||
|
</script>
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH">
|
||||||
|
</script>
|
||||||
|
</environment>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
@using AppWithP2PReference
|
||||||
|
@using AppWithP2PReference.Models
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace ClassLibrary
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
// Just here so this assembly has some compilation inputs.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||||
|
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||||
|
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj"/>
|
||||||
|
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="**\*.cshtml"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
|
<Reference Include="$(BinariesRoot)\System.Diagnostics.DiagnosticSource.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Html.Abstractions.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Runtime.dll"/>
|
||||||
|
<Reference Include="$(BinariesRoot)\Microsoft.AspNetCore.Razor.Test.MvcShim.dll"/>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - SimpleMvc</title>
|
||||||
|
|
||||||
|
<environment include="Development">
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
|
</environment>
|
||||||
|
<environment exclude="Development">
|
||||||
|
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
|
||||||
|
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||||
|
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||||
|
</environment>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">SimpleMvc</a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="container body-content">
|
||||||
|
@RenderBody()
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2017 - SimpleMvc</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<environment include="Development">
|
||||||
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
|
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
</environment>
|
||||||
|
<environment exclude="Development">
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||||
|
asp-fallback-test="window.jQuery"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
|
||||||
|
</script>
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
|
||||||
|
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
|
||||||
|
</script>
|
||||||
|
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||||
|
</environment>
|
||||||
|
|
||||||
|
@RenderSection("Scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
@using ClassLibrary
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||||
<!-- In test scenarios $(OriginalProjectRoot) is defined in a generated Directory.Build.props file -->
|
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||||
<ProjectReference Include="$(OriginalProjectRoot)\..\..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj"/>
|
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj"/>
|
||||||
<ProjectReference Include="$(OriginalProjectRoot)\..\..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj"/>
|
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
<ItemGroup Condition="'$(BinariesRoot)'==''">
|
||||||
<!-- In test scenarios $(OriginalProjectRoot) is defined in a generated Directory.Build.props file -->
|
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||||
<ProjectReference Include="$(OriginalProjectRoot)\..\..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj"/>
|
<ProjectReference Include="..\..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj"/>
|
||||||
<ProjectReference Include="$(OriginalProjectRoot)\..\..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj"/>
|
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Razor.Runtime\Microsoft.AspNetCore.Razor.Runtime.csproj"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue