Move targets, rzc and extension assembly in to the Sdk#2672
Conversation
b1a2050 to
6797e7f
Compare
| </Compile> | ||
| </ItemGroup> | ||
|
|
||
| <Target Name="LayoutDependencies" BeforeTargets="Build" Condition="'$(IsInnerBuild)' != 'true'"> |
There was a problem hiding this comment.
Weird MSBuild way to make things run a target AfterBuild
There was a problem hiding this comment.
What's wrong with AfterTargets="AfterBuild"?
There was a problem hiding this comment.
Apparently this is the way to run something after build - dotnet/msbuild#1680 (comment)
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(RazorLangVersion)'==''"> | ||
| <RazorLangVersion Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true'">2.1</RazorLangVersion> |
There was a problem hiding this comment.
We determine the RazorLangVersion and RazorDefaultConfiguration based on TFM. We'd need for a way to allow class libraries to specify this.
| <RazorSdkBuildTasksAssembly>$(RazorSdkBuildTasksDirectoryRoot)$(_RazorSdkTasksTFM)\Microsoft.NET.Sdk.Razor.Tasks.dll</RazorSdkBuildTasksAssembly> | ||
|
|
||
| <_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion.TrimStart('vV'))</_TargetFrameworkVersionWithoutV> | ||
| <_EnableAllInclusiveRazorSdk Condition="'$(_EnableInclusiveRazorSdk)' == '' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(_TargetFrameworkVersionWithoutV)' > '2.9'">true</_EnableAllInclusiveRazorSdk> |
There was a problem hiding this comment.
Needs a name. The SDK pivots on this value to determine if it needs to use the compiler \ targets from the Sdk. A 3.0 RCL would need to be able to specify this.
There was a problem hiding this comment.
_EnableAllInclusiveRazorSdk is dope.
Can you log a work item for 3.0 RCL support? I don't think we should try to solve that in this PR
There was a problem hiding this comment.
| <!-- | ||
| Use the suffix .Views when producing compiled view assemblies. This matches the requirements for Mvc's ViewsFeatureProvider. | ||
| --> | ||
| <RazorTargetNameSuffix Condition="'$(_EnableInclusiveRazorSdk)' == '' AND '$(RazorTargetNameSuffix)'==''">.Views</RazorTargetNameSuffix> |
There was a problem hiding this comment.
Need to play with this - ideally this is set based on the configuration. That said, I'm not super sure this is a particularly important problem to solve.
|
|
||
| MSBuildIntegrationTestBase.Project = ProjectDirectory.Create(_originalProjectName, _testProjectName, _baseDirectory, _additionalProjects, _language); | ||
| MSBuildIntegrationTestBase.TargetFramework = _originalProjectName.StartsWith("ClassLibrary") ? "netstandard2.0" : "netcoreapp2.2"; | ||
| MSBuildIntegrationTestBase.TargetFramework = _originalProjectName.StartsWith("ClassLibrary") ? "netstandard2.0" : "netcoreapp3.0"; |
There was a problem hiding this comment.
Yeah, this is fine for now. We should log an issue for 3.0 RCL support and solve this then.
| <PropertyGroup> | ||
| <_RazorMSBuildRoot>$(SolutionRoot)src\Microsoft.AspNetCore.Razor.Design\bin\$(Configuration)\</_RazorMSBuildRoot> | ||
| <RazorSdkBuildTasksDirectoryRoot>$(RazorSdkProjectDirectory)bin\$(Configuration)\</RazorSdkBuildTasksDirectoryRoot> | ||
| <RazorSdkDirectoryRoot>$(RazorSdkProjectDirectory)bin\$(Configuration)\sdk-output\</RazorSdkDirectoryRoot> |
There was a problem hiding this comment.
Building the sdk lays out binaries the same way it looks like in the package. Makes it easy to have one property to define all paths.
6797e7f to
a35d348
Compare
|
👏 👏 |
| "tools/Microsoft.CodeAnalysis.CSharp.dll": "This assembly is not owned by us and does not follow our conventions.", | ||
| "tools/Microsoft.CodeAnalysis.dll": "This assembly is not owned by us and does not follow our conventions." | ||
| "tools/netcoreapp2.0/Microsoft.CodeAnalysis.CSharp.dll": "This assembly is not owned by us and does not follow our conventions.", | ||
| "tools/netcoreapp2.0/Microsoft.CodeAnalysis.dll": "This assembly is not owned by us and does not follow our conventions." |
There was a problem hiding this comment.
Do we need to ship these here now that we are in the SDK? I'm not sure how all of this stuff gets constructed.
There was a problem hiding this comment.
Filed https://github.com/aspnet/Razor/issues/2675 to figure this out.
| <PropertyGroup> | ||
| <Description>Razor is a markup syntax for adding server-side logic to web pages. This package contains MSBuild support for Razor.</Description> | ||
| <TargetFrameworks>netstandard2.0;net46</TargetFrameworks> | ||
| <TargetFrameworks>netcoreapp2.2;netstandard2.0;net46</TargetFrameworks> |
There was a problem hiding this comment.
Required to reference Razor.Tools. Once we reference it we can make the build order more reliable and avoid file contention.
| <!-- Binaries that should be signed by corefx/roslyn --> | ||
| <ExcludePackageFileFromSigning Include="$(SdkOutputPath)tools\netcoreapp2.0\Microsoft.CodeAnalysis.CSharp.dll" /> | ||
| <ExcludePackageFileFromSigning Include="$(SdkOutputPath)tools\netcoreapp2.0\Microsoft.CodeAnalysis.dll" /> | ||
| <ExcludePackageFileFromSigning Include="$(SdkOutputPath)tools\netcoreapp2.0\runtimes\unix\lib\netstandard1.3\System.Text.Encoding.CodePages.dll" /> |
There was a problem hiding this comment.
I agree. Maybe addressing https://github.com/aspnet/Razor/issues/2675 would fix this issue. That said, it's been copied over from the Razor.Design project so this isn't new:
| --> | ||
| <PropertyGroup> | ||
| <!-- Continue setting this property to maintain compat with legacy Razor.Design --> | ||
| <IsRazorCompilerReferenced>true</IsRazorCompilerReferenced> |
There was a problem hiding this comment.
So if you are using the 3.0 SDK on a 2.0 project ..... how does this behave?
There was a problem hiding this comment.
This file only gets imported if a property is set (set by default for netcoreapp 3.0 or later projects).
| <!-- | ||
| Initialize properties and items inferred using the project version. This file is not imported in projects referencing | ||
| MVC \ Razor 2.2 or earlier since values specified here are provided via targets and props imported from NuGet packages | ||
| such as Microsoft.AspNetCore.Razor.Design. |
There was a problem hiding this comment.
Should IsRazorCompilerReferenced be here?
| <!-- | ||
| MVC uses a ProvideApplicationPartFactoryAttribute on the generated assembly to load compiled views from assembly. Set this to false, to prevent generating this attribute. | ||
| --> | ||
| <GenerateProvideApplicationPartFactoryAttribute>true</GenerateProvideApplicationPartFactoryAttribute> |
There was a problem hiding this comment.
Should this be in a .props? can the user's project override this
There was a problem hiding this comment.
Condition seems better. We want to set these up in 3.0 projects, a props file is too early for checking this.
| --> | ||
| <PropertyGroup Condition="'$(RazorDefaultConfiguration)'==''"> | ||
| <RazorDefaultConfiguration Condition="'$(_TargetingNETCoreApp30OrLater)' == 'true'">MVC-2.1</RazorDefaultConfiguration> | ||
| </PropertyGroup> |
There was a problem hiding this comment.
FYI we have a work item logged to create a 3.0 version of all of these assets. This is fine for now.
| Defines the ability to understand the configuration for the Razor language service provided by | ||
| the runtime/toolset packages. Introduced in 2.1 | ||
| --> | ||
| <ProjectCapability Include="DotNetCoreRazorConfiguration"/> |
There was a problem hiding this comment.
Should this be conditional? How would this work for a project targeting 2.0 but using a new VS/new SDK?
There was a problem hiding this comment.
Yup. I can move this to .Configuration.targets
| <Company>Microsoft</Company> | ||
| <Description>ClassLibrary Description</Description> | ||
|
|
||
| <_EnableAllInclusiveRazorSdk>true</_EnableAllInclusiveRazorSdk> |
There was a problem hiding this comment.
hmmmm - I think I want to understand this
There was a problem hiding this comment.
These are technically 3.0 targeting RCLs (without references to Razor.Design). Consequently we need for a way to tell the SDK to use the targets it ships. Essentially this - https://github.com/aspnet/Razor/issues/2676. There's an existing 2.1 RCL testapp that does not require this
rynowak
left a comment
There was a problem hiding this comment.
Lets discuss some of these deeets
a35d348 to
406d0ca
Compare
406d0ca to
1b00d79
Compare
No description provided.