Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Move targets, rzc and extension assembly in to the Sdk#2672

Merged
pranavkm merged 1 commit into
masterfrom
prkrishn/move-into-sdk
Oct 30, 2018
Merged

Move targets, rzc and extension assembly in to the Sdk#2672
pranavkm merged 1 commit into
masterfrom
prkrishn/move-into-sdk

Conversation

@pranavkm
Copy link
Copy Markdown
Contributor

No description provided.

@pranavkm pranavkm requested a review from rynowak October 25, 2018 22:31
@pranavkm pranavkm force-pushed the prkrishn/move-into-sdk branch 2 times, most recently from b1a2050 to 6797e7f Compare October 25, 2018 22:33
</Compile>
</ItemGroup>

<Target Name="LayoutDependencies" BeforeTargets="Build" Condition="'$(IsInnerBuild)' != 'true'">
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird MSBuild way to make things run a target AfterBuild

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with AfterTargets="AfterBuild"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We determine the RazorLangVersion and RazorDefaultConfiguration based on TFM. We'd need for a way to allow class libraries to specify this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<RazorSdkBuildTasksAssembly>$(RazorSdkBuildTasksDirectoryRoot)$(_RazorSdkTasksTFM)\Microsoft.NET.Sdk.Razor.Tasks.dll</RazorSdkBuildTasksAssembly>

<_TargetFrameworkVersionWithoutV>$(TargetFrameworkVersion.TrimStart('vV'))</_TargetFrameworkVersionWithoutV>
<_EnableAllInclusiveRazorSdk Condition="'$(_EnableInclusiveRazorSdk)' == '' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(_TargetFrameworkVersionWithoutV)' &gt; '2.9'">true</_EnableAllInclusiveRazorSdk>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<!--
Use the suffix .Views when producing compiled view assemblies. This matches the requirements for Mvc's ViewsFeatureProvider.
-->
<RazorTargetNameSuffix Condition="'$(_EnableInclusiveRazorSdk)' == '' AND '$(RazorTargetNameSuffix)'==''">.Views</RazorTargetNameSuffix>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that seems fine for now.


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";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#yolo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pranavkm pranavkm force-pushed the prkrishn/move-into-sdk branch from 6797e7f to a35d348 Compare October 26, 2018 00:29
@rynowak
Copy link
Copy Markdown
Member

rynowak commented Oct 26, 2018

👏 👏

Comment thread NuGetPackageVerifier.json
"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."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems really fragile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

https://github.com/aspnet/Razor/blob/master/src/Microsoft.AspNetCore.Razor.Design/Microsoft.AspNetCore.Razor.Design.csproj#L39-L42

-->
<PropertyGroup>
<!-- Continue setting this property to maintain compat with legacy Razor.Design -->
<IsRazorCompilerReferenced>true</IsRazorCompilerReferenced>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you are using the 3.0 SDK on a 2.0 project ..... how does this behave?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should IsRazorCompilerReferenced be here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

<!--
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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in a .props? can the user's project override this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or have a condition

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"/>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be conditional? How would this work for a project targeting 2.0 but using a new VS/new SDK?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I can move this to .Configuration.targets

<Company>Microsoft</Company>
<Description>ClassLibrary Description</Description>

<_EnableAllInclusiveRazorSdk>true</_EnableAllInclusiveRazorSdk>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmmm - I think I want to understand this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

@rynowak rynowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets discuss some of these deeets

Copy link
Copy Markdown
Member

@rynowak rynowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: based on replies

@pranavkm pranavkm force-pushed the prkrishn/move-into-sdk branch from a35d348 to 406d0ca Compare October 30, 2018 20:46
@pranavkm pranavkm force-pushed the prkrishn/move-into-sdk branch from 406d0ca to 1b00d79 Compare October 30, 2018 20:48
@pranavkm pranavkm merged commit 0bd6d13 into master Oct 30, 2018
@pranavkm pranavkm deleted the prkrishn/move-into-sdk branch October 30, 2018 21:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants