-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Adds Post-Processing feature. Related issue #144 #148
Conversation
Part of #144
…ironment: Format: $(SolutionPath);$(MSBuildThisFileFullPath);...populated property names...;.... ``` <Target Name="DllExportPostProc"> <!-- Now we can access the following properties and items: $(DllExport) - version $(DllExportSln) - full path to .sln which controls current project $(DllExportPrj) - full path to current project where processed .NET DllExport @(DllExportDirX64) - $(TargetDir)x64\*.* @(DllExportDirX86) - $(TargetDir)x86\*.* @(DllExportDirBefore) - $(TargetDir)Before\*.* @(DllExportDirAfter) - $(TargetDir)After\*.* @(DllExportDependents + populated property name) - each populated properties from DllExportInvokedPoint, e.g. DllExportDependentsTargetDir @(DllExportDependencies + populated property name) - each populated properties from DllExportInvokedPoint, e.g. DllExportDependenciesTargetDir --> </Target> ```
I implemented backend logic with configurable environment. ANY properties can be populated like for parent projects (depend on) and/or current dependencies where processed. Currently no GUI but it's planned. Later. How to play with this today:
Format: For example: <PropertyGroup>
<DllExportProcEnv>
$(SolutionPath);$(MSBuildThisFileFullPath);
TargetDir;
AssemblyName;
TargetPath;
...
</DllExportProcEnv>
</PropertyGroup>
<Target Name="DllExportPostProc">
<!-- Now we can access the following properties and items:
$(DllExport) - version
$(DllExportSln) - full path to .sln which controls current project
$(DllExportPrj) - full path to current project where processed .NET DllExport
@(DllExportDirX64) - $(TargetDir)x64\*.*
@(DllExportDirX86) - $(TargetDir)x86\*.*
@(DllExportDirBefore) - $(TargetDir)Before\*.*
@(DllExportDirAfter) - $(TargetDir)After\*.*
@(DllExportDependents + populated property name)
- each populated properties from DllExportProcEnv,
e.g. DllExportDependentsTargetDir
@(DllExportDependencies + populated property name)
- each populated properties from DllExportProcEnv,
e.g. DllExportDependenciesTargetDir
@(DllExportSeqDependents + populated property name)
- each populated properties from DllExportProcEnv,
e.g. DllExportSeqDependentsTargetDir
-->
</Target>
Can you confirm this solution for your case? For example, for the case with #144 we need like this: <Target Name="DllExportPostProc">
<Copy SourceFiles="@(DllExportDirX64)" OverwriteReadOnlyFiles="true"
DestinationFolder="@(DllExportDependentsTargetDir->'%(Identity)x64\')" />
<Copy SourceFiles="@(DllExportDirX86)" OverwriteReadOnlyFiles="true"
DestinationFolder="@(DllExportDependentsTargetDir->'%(Identity)x86\')" />
</Target> Let me know if any bugs. update: update2: new update3: future updates will be on the new wiki page: https://github.com/3F/DllExport/wiki/PostProc#post-processing |
@3F Thanks for your work so far. I've been having some trouble reproducing your results on my side, but it appears to be because I have something misconfigured. I'm a bit unsure on which project I need to put the I'd appreciate for you to explain a bit more on your answer. Here's my project structure:
|
Any modification should be only where DllExport is installed. That is, for your case:
Minimal for the case when |
+Checking the existence of our entry point
That is, *! Some Post-Proc features are not yet available in GUI. But you can already configure it with msbuild.
Please note: |
@NickAcPT I added basic GUI support for predefined options, please check this out. It covers at least your case. That is, today some Post-Proc features are not yet available in GUI. Only manual configuring with msbuild as I said before. Since this PR is mainly for adding an Post-processing support, full GUI will be considered through a new one, and seems like not for 1.7.1. Of course anybody can open PR to get this ASAP. Welcome. |
@3F Sorry for the huge delay. Haven't had much time to mess with this for a while. Thanks a lot for the work you've done. I've ran across a problem when using Fody.Costura (haven't tried yet with your ILMerge post processing step). Exception
I'll update this comment if I find anything else. |
@NickAcPT Thank you for the important information! What build or commit have you tried? Is this a new error after #148 (comment) ? Can you please use /v:diag to show more details after |
Actually I'm watching Or it could be a problem with new flags in MvsSln: SlnItems.ProjectDependenciesXml | SlnItems.LoadMinimalDefaultData Because I tested only this: |
+PostProc +PreProc
Sure, which details do you need? |
I need the following:
<ProjectReference Include="ClassLibrary2.csproj">
<Project>{64ad76ca-2c85-4039-b0b3-734cf02b2999}</Project>
<Name>ClassLibrary2</Name>
</ProjectReference>
<ProjectGuid>{6CE57BB1-4A6D-4714-B775-74A3637EC992}</ProjectGuid>
Thanks, |
…nces Related: 3F/DllExport#148 (comment) +Updated tests
I've tried it and came across this error. |
Thanks for the reply,
|
Oh, no problem 😄 |
@NickAcPT Thank you for the detailed information. Yep, I didn't think first about obsolete projectguid in ProjectReference, but yes, MS avoids an obsolete projectguid in any modern places. My bad. And my issue btw: 3F/MvsSln#18 So, this is it, MvsSln expects this format: <ProjectReference Include="..\WinTabby.Hooks\WinTabby.Hooks.csproj" Project="18816D42-416D-4D2B-83F5-1DF7353184AD" /> But the new is: <ProjectReference Include="..\WinTabby.Hooks\WinTabby.Hooks.csproj" /> The error is controlled by 3F/MvsSln#26 |
…solete projectguid
Added |
Can confirm it builds now! Thanks a lot for all the work! |
I've noticed a problem that doesn't go away after cleaning and rebuilding when the solution is structured as this:
My end-goal with ProjectC referencing ProjectA is to have it so it also would copy the x64/x86 folders to the output of the ProjectC. Edit: forgot to attach the build error. |
I'm not sure if it is related to the PR, but on the Pre-processing tab there is a task to run ILMerge, even on .NET Core/Standard projects, but it only works on .NET Framework projects. I've read here that there's a way to make .NET Core executables/dlls into one single file with some changes, but it requires publishing the project ( |
Well, I forgot about recursion for multiple destination in msbuild task :) That is, instead of Since <Target AfterTargets="DllExportPostProc" Name="DllExportPostProcForDependent"
Outputs="%(DllExportDependentsTargetDir.Identity)">
<Copy SourceFiles="@(DllExportDirX64)" OverwriteReadOnlyFiles="true"
DestinationFolder="%(DllExportDependentsTargetDir.Identity)\x64\" />
...
</Target> As you can see, any other custom targets can easily extend our So, I'll update logic ASAP. You can also try it yourself to make sure before I start. |
As I remember, I tested both types including .NET Core based projects. Or please clarify the case. Better to open a new issue if you found error related to the other planned Pre-processing feature. |
* NEW: Activating ProjectReferences for existing ProjectDependencies (shallow copy) through new flag. Issue #25. ``` ProjectDependenciesXml = 0x0800 | ProjectDependencies | Env, ``` Covers ProjectDependencies (SLN) logic using data from project files (XML). Helps eliminate miscellaneous units between VS and msbuild world: #25 (comment) Requires Env with loaded projects (LoadMinimalDefaultData or LoadDefaultData). A core feature in .NET DllExport Post-processing: 3F/DllExport#148 * NEW: `ProjectReference` support without obsolete projectguid. Issue #26. * NEW: IXProject methods: ``` +IXProject.GetFullPath(string relative) ``` * FIXED: Fixed possible empty records in SlnParser.SetProjectItemsConfigs. * FIXED: Fixed `The given key was not present...` when different case for keys in Item.Metadata. * FIXED: Fixed protected XProject GetProjectGuid() + GetProjectName() when empty property. * CHANGED: Compatible signature update for `ForEach<T>` extension method: ``` IEnumerable<T> ForEach<T>(this IEnumerable<T> items, Action<T> act) ``` * CHANGED: Updated Microsoft.CSharp 4.7.0 (Only for: netstandard2.0 + netcoreapp2.1) * CHANGED: Updated Microsoft.Build 16.5.0 (Only for: netcoreapp2.1)
I tried it.
Was I supposed to see any changes on ProjectC? Don't think it created a task there. Even if not. Tried it and on ProjectA, I see these two targets: <Target Name="DllExportPostProc" Label="8337224c9ad9e356" />
<Target Name="DllExportPostProcForTargetDir" AfterTargets="DllExportPostProc" Label="8337224c9ad9e356" Outputs="%(DllExportDependentsTargetDir.Identity)">
<Copy SourceFiles="@(DllExportDirX86)" DestinationFolder="%(DllExportDependentsTargetDir.Identity)x86\" OverwriteReadOnlyFiles="true" />
<Copy SourceFiles="@(DllExportDirX64)" DestinationFolder="%(DllExportDependentsTargetDir.Identity)x64\" OverwriteReadOnlyFiles="true" />
</Target>
|
It looks correct. Any data should be configured only in ProjectA! While ProjectB + ProjectC will magically receive x86+x64 folders from ProjectA. |
There you go. |
I get it, we're talking about different cases when you're talking about Because:
Is not the same to:
That's more complex way because it also can be as:
And I have a lot of questions if this type. For example,
Well, don't know... |
Okay, I also added
This includes sequential referencing through other projects. For GUI find See fc5344f However, for other specific controls and options you need to open new PR. I will not personally consider this at least here. |
Can confirm that it works. |
Good! Thanks for the confirmation. |
* NEW: Pre-Processing feature. PR #146. Related issue #40 Official ILMerge support; https://github.com/dotnet/ILMerge Quick integration with Conari for most easy access to unmanaged features; https://github.com/3F/Conari +Other related tools and assembly manipulations. Manual configuring: #40 (comment) * NEW: Post-Processing. PR #148. Continues direction of Pre-Processing feature. PR #146 Related issue #144 Explanation and details: https://ko-fi.com/Blog/Post/ILMerge---Conari---Debug-information---DllExport-=-O5O61MV8A 1.7.1 Provides only basic GUI support for predefined options. Thus, *! Some Post-Proc features are not yet available in GUI. But you can already configure it with msbuild: ``` <Target Name="DllExportPostProc"> <!-- After activation, you can access the following properties and items: $(DllExport) - version $(DllExportSln) - full path to .sln which controls current project $(DllExportPrj) - full path to current project where processed .NET DllExport @(DllExportDirX64) - $(TargetDir)x64\*.* @(DllExportDirX86) - $(TargetDir)x86\*.* @(DllExportDirBefore) - $(TargetDir)Before\*.* @(DllExportDirAfter) - $(TargetDir)After\*.* @(DllExportDependents + populated property name) - each populated properties from DllExportProcEnv, e.g. DllExportDependentsTargetDir @(DllExportDependencies + populated property name) - each populated properties from DllExportProcEnv, e.g. DllExportDependenciesTargetDir @(DllExportSeqDependents + populated property name) - each populated properties from DllExportProcEnv, e.g. DllExportSeqDependentsTargetDir --> </Target> ``` #148 (comment) * NEW: Optional copying of intermediate files + x86+x64 directories into output for projects that dependent on projects where used DllExport. Issue #144. Including sequential referencing through other projects: #148 (comment) * FIXED: Fixed #140 ... failed to create safe SSL/TLS context. * FIXED: Pack of fixes for .net.dllexport.targets. PR #147. * Fixed "Cannot modify an evaluated object originating in an imported file". * Fixed possible duplication in .net.dllexport.targets when configuring. * Adds removing TargetsFile if not used. * Fixed possible loss of settings in .targets when configuring. * FIXED: Fixed #143 'Microsoft.NET.Sdk' specified could not be found. * FIXED: A multiple empty `<PropertyGroup />` in project files during new configuration. * CHANGED: Wizard. Dropped support for ssl3 + tls1.0 + tls1.1 * CHANGED: Wizard. Simplified notification for stable versions. * CHANGED: Manager. Access to hMSBuild tool (packed) via `-hMSBuild` key. https://github.com/3F/hMSBuild Since it uses packed version (while GetNuTool is integrated inside), you need use -dxp-version to control specific version. * CHANGED: Updated Cecil 0.11.2 https://github.com/jbevain/cecil/releases/tag/0.11.2 * CHANGED: Updated MvsSln 2.5.2 https://github.com/3F/MvsSln/releases/tag/2.5.2
Closes #144
Continues direction of PR #146
Explanation and details:
DllExported
dlls on another project #144 (comment)This also updates MvsSln (core of this PR) to 2.5.2 since current PR was based on features that were updated in 2.5.2: