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

Remove ViewCompilation from publish manifest #167

Merged
merged 2 commits into from
Jun 20, 2017

Conversation

JunTaoLuo
Copy link
Contributor

@JunTaoLuo JunTaoLuo commented Jun 19, 2017

We are running into an issue where the store generated on windows and non-windows are different. The windows stores (x86 and x64) do not contain the M.A.Mvc.Razor.ViewCompilation while the non windows store (macOS and linux) do not. Our assumption that the stores on all platforms are the same is now broken so our approach of trimming by all manifests no longer works. We need to react accordingly in the M.A.All metapackage target and the proposal is to remove the ViewCompilation entry from the manifest so it will never be trimmed.

This would resolve aspnet/MvcPrecompilation#146, note that after preview2 we plan to remove ViewCompilation from the runtime store so this will not be an issue for the next release.

I also ported the fix from #143, this helps us resolve #161 without having to manually update the target file in the M.A.All package.


<PropertyGroup>
<TargetManifestFiles Condition="'$(OS)' == 'Windows_NT'">$(TargetManifestFiles);@(WindowsAspNetCoreTargetManifestFiles)</TargetManifestFiles>
<TargetManifestFiles Condition="'$(OS)' != 'Windows_NT'">$(TargetManifestFiles);@(NonWindowsAspNetCoreTargetManifestFiles)</TargetManifestFiles>
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this mean we can no longer publish Linux apps from Windows and vice-versa?

@JunTaoLuo JunTaoLuo changed the title Trim by windows or non-windows manifests Remove ViewCompilation from publish manifest Jun 19, 2017
@JunTaoLuo JunTaoLuo force-pushed the johluo/platform-specific-manifests branch from 677f152 to 9ebd42e Compare June 20, 2017 00:19
@@ -208,6 +211,11 @@
<SetEnvironmentVariable Variable="PATH" Value="$(PATH);$(DiaSymReaderDirectory)" />
</Target>

<Target Name="_RemoveViewCompilationFromManifest">
<Exec Command="powershell.exe -command &quot;Get-Content $(ManifestFileWithViewCompilation) | Where-Object {$_ -inotmatch ''} | Set-Content $(ManifestFileWithViewCompilation)&quot;" Condition="'$(OS)' == 'Windows_NT'"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only need to remove on macOS and linux.

@JunTaoLuo JunTaoLuo force-pushed the johluo/platform-specific-manifests branch from 09e6b14 to 67738fe Compare June 20, 2017 00:41
Copy link
Contributor

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

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

Are the changes in Microsoft.AspNetCore.All.csproj and PublishWithAspNetCoreTargetManifest.targets required for Preview2? They seem riskier than the core change in repo.targets.

@natemcmaster
Copy link
Contributor

@JunTaoLuo JunTaoLuo force-pushed the johluo/platform-specific-manifests branch from 67738fe to 89a2dad Compare June 20, 2017 01:12
@@ -166,6 +166,9 @@
<!--Drop a nuspec file in artifacts for packing zip files into a nupkg-->
<Copy SourceFiles="$(RepositoryRoot)build\Build.RS.nuspec" DestinationFolder="$(ArtifactsDir)" Condition="'$(OSPlatform)'=='Linux'" />
<WriteLinesToFile File="$(ArtifactsDir)version.txt" Lines="$(VersionPrefix)-$(VersionSuffix)" Overwrite="true" Condition="'$(OSPlatform)'=='Linux'" />

<!-- Preview 2 Workaround: remove Microsoft.AspNetCore.Mvc.Razor.ViewCompilation from publish manifest -->
<Exec Command="sed -i -e '/microsoft.aspnetcore.mvc.razor.viewcompilation/d' $(ArtifactsDir)%(PackageStoreManifestFiles.TimestampDestinationFile)" Condition="'$(OS)' != 'Windows_NT'" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we just remove the package reference? Why mess with the build output?

Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Jun 20, 2017

Choose a reason for hiding this comment

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

I thought this may be pulled in transitively and we want to change as few things as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, it's a standalone top-level package. Should be safe to just remove the package reference.

Copy link
Contributor Author

@JunTaoLuo JunTaoLuo Jun 20, 2017

Choose a reason for hiding this comment

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

Actually wouldn't we need to make it a FullMetaPackagePackageNoRuntimeStoreReference? We want it to be a transitive dependency I assume? But not in the runtime store.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we'd need to remove the PrivateAssets=All metadata

Copy link
Contributor

Choose a reason for hiding this comment

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

Spoke to @JunTaoLuo offline. Seems like this is the only way right now to get a reference in the package, but not have the package in the store.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To clarify, we are not removing the package from the store, we just never use the one in the store by forcing ViewCompilation to be bin deployed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel the alternative which is to remove it from the store completely is doable, but I'd want to test it more since it's slightly more riskier. Figured better to unblock the build with this now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants