-
Notifications
You must be signed in to change notification settings - Fork 16
Add support for pre-compiling desktop applications. #130
Conversation
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="build\**\*" Pack="true" PackagePath="%(Identity)" /> | ||
<None Include="buildMultiTargeting\*" Pack="true" PackagePath="%(Identity)" /> | ||
<None Include="$(X86ProjectDirectory)\bin\$(Configuration)\net461\win7-x86\$(MSBuildThisFileName)-x86.exe" Pack="true" PackagePath="lib\net461\$(MSBuildThisFileName)-x86.exe" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pranavkm The scaffolding guys handle x86 by having their own tool have a x86 RID. Since it's compatible with x64 all just works. Is there a reason why we did this approach for so long?
Leaving as is for now because it's worked in the past; however, these bits would be significantly simpler without the extra project/x86ness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely remember this having to do something with the RID inference during the old project.json days, but not sure.
Having a single executable with x86 makes the size of the nupkg smaller, other than that I am not opinionated about this approach or the one that scaffolding takes.
Note that this wasn't a "just revert an old commit" I had to do most of this stuff manually and rely on tests for confidence. Lots of changes here that have never existed in this repo. |
"lib/netcoreapp2.0/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.dll": "Not a class library. Docs not required for CLI tools" | ||
}, | ||
"BUILD_ITEMS_FRAMEWORK": { | ||
"*": "Doesn't matter" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:thuglife:
@prafullbhosale could you take a look at this guy to ensure everything looks good? |
build/common.props
Outdated
@@ -16,4 +16,8 @@ | |||
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkVersion)" PrivateAssets="All" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'"> | |||
<PackageReference Include="NETStandard.Library.NETFramework" Version="$(NETStandardLibraryNETFrameworkVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: PrivateAssets="All"
@@ -0,0 +1,18 @@ | |||
<!-- | |||
Copyright (c) .NET Foundation. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the copyright header. Per my last conversation about this with @Eilon, we don't put the copyright header into .targets/props files that ship in nuget packages.
<Target | ||
Name="MvcRazorPrecompile" | ||
DependsOnTargets="_ResolveInputArguments" | ||
Inputs="$(MSBuildThisFileFullPath);@(MvcRazorFilesToCompile);@(IntermediateAssembly);@(DocFileItem);@(_DebugSymbolsIntermediatePath);@(ReferencePath);$(MSBuildAllProjects);" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use MSBuildAllProjects as an input, you should also add this file to that list.
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm? That is in the list; I think I'm misunderstanding your ask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, let me clarify.
The reason for using MSBuildAllProjects is to invalidate target caches when project files change. If there is anything down stream from this target (i.e. publishing), you should add this file to the MSBuildAllProjects list. This is a best practice when writing incremental build targets that chain into other targets you don't control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I gets it now 👍
<CallTarget Targets="_CreateResponseFileForMvcRazorPrecompile" /> | ||
|
||
<ItemGroup Condition="'$(PlatformTarget)'=='x86'"> | ||
<FilesToCopy Include="$(OutputPath)$(AssemblyName).exe.config"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FilesToCopy
is a fairly generic itemgroup name. My concern is that other targets may populate items into this. If they do, the Copy
and Delete
tasks below may fail or operation on the wrong files.
To be safe, give it a more specific name (_PreCompilationFilesToCopy
) or clear it before using it <FilesToCopy Remove="@(FilesToCopy)" />
.
SourceFiles="@(FilesToCopy)" | ||
DestinationFiles="%(Destination)" /> | ||
|
||
<Message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this log message as it doesn't really contain any useful information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna leave. It's consistent with the already existing netcoreapp2.0 variant.
|
||
public ApplicationTestFixture Fixture { get; } | ||
|
||
[Fact(Skip = "https://github.com/dotnet/corefx/issues/20364")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in latest builds of NS.Library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why they closed that issue. Still need dotnet/sdk#1259 to be completed before everything works as expected.
@@ -1,6 +1,7 @@ | |||
<Project Sdk="Microsoft.NET.Sdk.Web"> | |||
<PropertyGroup> | |||
<TargetFramework>netcoreapp2.0</TargetFramework> | |||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like every testapp has been updated to multi-target. Do you have any test apps that are only single TFMS? Would be good to keep some of these test cases around as that is the more common scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, SimpleAppDesktopOnly
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just .NET Core (for xplat)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, is that something we typically test separately? I can see the value in having 1 single TFM test for tools because of how they're launched but I'm not seeing a reason to have a single targeting TFM for both netcoreapp2.0 and net461.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO there is some value to test all entry points to view compilation. There are three: buildMultiTargeting/ViewCompilation.targets
, build/net461/ViewCompilation.targets
and build/netcoreapp2.0/ViewCompilation.targets
. It's good to ensure all of these work correctly when they are the "entry point" import for view precompilation, aka the outer-build of a project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous comments are not relevant now that buildMultiTargeting stuff is gone. Should be fine as is.
<PropertyGroup> | ||
<TargetFramework>net461</TargetFramework> | ||
<RuntimeIdentifier>win7-x64</RuntimeIdentifier> | ||
<PreserveCompilationContext>true</PreserveCompilationContext> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PreserveCompilationContext and OutputType can be removed. These are already the default values for projects that use Microsoft.NET.Sdk.Web
@@ -0,0 +1,20 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having a completely separate project for the x86 version, why not just compile ViewCompilation.csproj multiple times with different configurations? It will reduce the effort required to keep the two csproj files aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(AspNetCoreVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.RazorPages" Version="$(AspNetCoreVersion)" /> | ||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" /> | ||
<ProjectReference Include="$(X86ProjectDirectory)$(MSBuildThisFileName)-x86.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='net461'" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we should be able to condense this to one project file. MSBuild is designed to handle this need w/o creating a separate csproj.
🆙 📅 |
@@ -0,0 +1,14 @@ | |||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buildMultiTargeting
folder should be moved up a level. It won't land in the right place in the nupkg because this is under build
.
🆙 📅 The multi-targeting bits weren't used. Removed them from the system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over all @natemcmaster's review captures pretty much everything.
|
||
<PropertyGroup Condition="'$(MvcRazorRunCommand)'==''"> | ||
<MvcRazorRunCommand Condition="'$(PlatformTarget)'=='x86'">$(OutputPath)$(MSBuildThisFileName)-x86.exe</MvcRazorRunCommand> | ||
<MvcRazorRunCommand Condition="'$(PlatformTarget)'!='x86'">$(OutputPath)$(MSBuildThisFileName).exe</MvcRazorRunCommand> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified by having a default and then overriding if '$(PlatformTarget)'=='x86'
👀 Could someone review this please? |
@@ -2,12 +2,13 @@ | |||
<Import Project="$(MSBuildThisFileDirectory)..\common.targets" /> | |||
<PropertyGroup> | |||
<MvcRazorRunCommand>dotnet</MvcRazorRunCommand> | |||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to the net461 targets file, too
🆙 📅 |
Getting this in unless someone objects. |
96d97d7
to
883114b
Compare
0989301
to
b7f1207
Compare
#128