-
Notifications
You must be signed in to change notification settings - Fork 6
Enable plugin/workflow-activity dependency merging #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zekelinAlex
wants to merge
7
commits into
TALXIS:master
Choose a base branch
from
zekelinAlex:users/alexander.zekelin/merge-plugin-dependencies
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cd27249
code app added to slnx
zekelinAlex 42c7eee
Merge branch 'TALXIS:master' into master
zekelinAlex dce9802
Enable plugin/workflow-activity dependency merging
zekelinAlex 6d05d97
fix: skip every Microsoft.Xrm.Sdk.* sub-namespace, not just two
zekelinAlex 34ea5d2
refactor: move ILRepack auto-wiring from Tasks to Plugin/WorkflowActi…
zekelinAlex e5f5ac3
fix: per-package ILRepack stub, absolute LibraryPath
zekelinAlex 5ee3df6
Merge branch 'TALXIS:master' into users/alexander.zekelin/merge-plugi…
zekelinAlex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- | ||
| No-op stub. MergePluginDependencies.targets sets $(ILRepackTargetsFile) | ||
| to point at this file so that ILRepack.Lib.MSBuild.Task's auto-merge | ||
| target is suppressed (its condition is `!Exists($(ILRepackTargetsFile))`). | ||
| Lives outside the Targets/ wildcard folder so it is NOT auto-imported | ||
| (re-importing it via $(ILRepackTargetsFile) would otherwise raise MSB4011). | ||
| --> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| </Project> |
87 changes: 87 additions & 0 deletions
87
src/Dataverse/Tasks/msbuild/tasks/Targets/MergePluginDependencies.targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
|
||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
|
||
| <!-- | ||
| Merge managed dependencies into the plugin/workflow-activity DLL so the | ||
| Dataverse sandbox (which loads a single assembly) can resolve all types | ||
| without sibling DLLs. | ||
|
|
||
| Runs AfterTargets="Build" for projects with <ProjectType>Plugin</ProjectType> | ||
| or <ProjectType>WorkflowActivity</ProjectType>. Picks every DLL that ended | ||
| up in $(OutDir) (bin/<Config>/<TF>/) and merges them into the main DLL, | ||
| EXCEPT assemblies the Dataverse sandbox already provides (Microsoft.Xrm.Sdk*, | ||
| Microsoft.Crm.Sdk.Proxy, System.*, mscorlib, Newtonsoft.Json). | ||
|
|
||
| Idempotent: always reads the raw compiler output from | ||
| $(IntermediateOutputPath) as the primary, never the already-merged bin file. | ||
| This lets the target safely re-run multiple times in the same Solution build | ||
| (SDK invokes Build on the plugin project from two different chains) without | ||
| duplicate-type errors. | ||
|
|
||
| Disable for a specific project with: | ||
| <PropertyGroup> | ||
| <TalxisMergePluginDependencies>false</TalxisMergePluginDependencies> | ||
| </PropertyGroup> | ||
| --> | ||
|
|
||
| <PropertyGroup> | ||
| <TalxisMergePluginDependencies Condition="'$(TalxisMergePluginDependencies)' == ''">true</TalxisMergePluginDependencies> | ||
| <!-- Suppress the auto-merge target shipped with ILRepack.Lib.MSBuild.Task | ||
| (which runs AfterTargets="Build" in Release config and would conflict | ||
| with our target). The package skips its auto-target when | ||
| $(ILRepackTargetsFile) points at an existing file — point it at a | ||
| dedicated no-op stub that lives OUTSIDE the Targets/ wildcard folder | ||
| (so it is not auto-imported; re-importing it via $(ILRepackTargetsFile) | ||
| would otherwise raise MSB4011). --> | ||
| <ILRepackTargetsFile Condition="'$(ILRepackTargetsFile)' == ''">$(MSBuildThisFileDirectory)..\StubForILRepack.targets</ILRepackTargetsFile> | ||
| </PropertyGroup> | ||
|
|
||
| <Target Name="TalxisMergePluginDependencies" | ||
| AfterTargets="Build" | ||
| Condition=" '$(TalxisMergePluginDependencies)' == 'true' | ||
| and ('$(ProjectType)' == 'Plugin' or '$(ProjectType)' == 'WorkflowActivity') "> | ||
| <PropertyGroup> | ||
| <_TalxisMergePrimaryRaw>$(IntermediateOutputPath)$(AssemblyName).dll</_TalxisMergePrimaryRaw> | ||
| <_TalxisMergeOutputDll>$(OutDir)$(AssemblyName).dll</_TalxisMergeOutputDll> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <_TalxisMergeAll Include="$(OutDir)*.dll" /> | ||
| <_TalxisMergePrimary Include="@(_TalxisMergeAll)" | ||
| Condition=" '%(Filename)%(Extension)' == '$(AssemblyName).dll' " /> | ||
| <_TalxisMergeDeps Include="@(_TalxisMergeAll)" Exclude="@(_TalxisMergePrimary)" /> | ||
| <!-- Drop sandbox-provided assemblies; merging them would clash with the | ||
| platform-supplied versions at runtime inside the sandbox. --> | ||
| <_TalxisMergeDeps Remove="@(_TalxisMergeDeps)" | ||
| Condition=" '%(Filename)' == 'mscorlib' | ||
| Or '%(Filename)' == 'netstandard' | ||
| Or '%(Filename)' == 'Newtonsoft.Json' | ||
| Or '%(Filename)' == 'Microsoft.Xrm.Sdk' | ||
| Or '%(Filename)' == 'Microsoft.Xrm.Sdk.Deployment' | ||
| Or '%(Filename)' == 'Microsoft.Xrm.Sdk.Workflow' | ||
|
zekelinAlex marked this conversation as resolved.
Outdated
|
||
| Or '%(Filename)' == 'Microsoft.Crm.Sdk.Proxy' | ||
| Or $([System.String]::Copy('%(Filename)').StartsWith('System.')) " /> | ||
| </ItemGroup> | ||
|
|
||
| <Message Importance="high" | ||
| Text="TalxisMergePluginDependencies: merging into $(AssemblyName).dll -> @(_TalxisMergeDeps->'%(Filename)', ', ')" | ||
| Condition=" '@(_TalxisMergeDeps)' != '' " /> | ||
| <Message Importance="high" | ||
| Text="TalxisMergePluginDependencies: nothing to merge" | ||
| Condition=" '@(_TalxisMergeDeps)' == '' " /> | ||
|
|
||
| <!-- Internalize=false: keep merged types with their original public names. | ||
| With Internalize=true ILRepack prepends a GUID to type names | ||
| (e.g. <abc-def>WorkflowActivityBase), breaking Dataverse's | ||
| reflection-based detection of plugin / workflow-activity types via | ||
| IsSubclassOf(typeof(CodeActivity)) / interface lookup. --> | ||
| <ILRepack Condition=" '@(_TalxisMergeDeps)' != '' " | ||
| Parallel="true" | ||
| Internalize="false" | ||
| InputAssemblies="$(_TalxisMergePrimaryRaw);@(_TalxisMergeDeps)" | ||
| OutputFile="$(_TalxisMergeOutputDll)" | ||
| KeyFile="$(AssemblyOriginatorKeyFile)" | ||
| LibraryPath="$(OutDir)" /> | ||
| </Target> | ||
|
|
||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.