-
-
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
PackageReference support in VS 2017 #36
Comments
today I checked PackageReference and...
nope, no any .targets if we use PackageReference, just references: <ItemGroup>
<PackageReference Include="DllExport">
<Version>0.0.1</Version>
</PackageReference>
</ItemGroup> However if we'll use Packages.config it will: <Import Project="..\packages\DllExport.1.5.2\build\net20\DllExport.targets" Condition="Exists('..\packages\DllExport.1.5.2\build\net20\DllExport.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\DllExport.1.5.2\build\net20\DllExport.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\DllExport.1.5.2\build\net20\DllExport.targets'))" />
</Target> I already used
that package can be installed for both type of projects at the same time for .NET CLR and native (unmanaged) like C++ etc. but for PackageReference I don't know exactly about support - is it really supported ? If you talk about it above ... where to look documentation for |
hmm, PackageReference uses global cache for each received package, thus we have problem for current impl. of the ddNS feature #2 :( but in general, it also requires full review for the new distribution and configuration because of removed install/uninstall scripts. Primarily we have a tool for service of user projects, and the It looks like decision with solution-level >( Guys from NuGet team seems don't understand at all that we can have tools instead of libraries to service of any projects, libraries, the build processes etc. :( well, need to review all this |
…#38 We'll support only information about new installer because: * The `\build` feature still does not guarantee of work for all cases. #36 (comment) * We don't have any guaranteed information about uninstall operation for our package because of removed uninstall.ps1 #38
:) Good ! More than one way for distribution would be useful anyway. Actually I already finished the new distribution & manager that described in #38 The short illustration of our new future manager:
In total, it contains now lightweight but powerful manager (100% adapted for our project) via new https://github.com/3F/MvsSln & https://github.com/3F/GetNuTool I hope to release beta on the next week.
The main problem here - we are not a library, we are tool. We already discussed about this here NuGet/Home#1521 (comment) But mainly NuGet focused now for libraries only. The The second problem the non-controlled global caching at all. I don't see any features (API etc.) to control this. Through new our manager we can: <Reference Include="DllExport, Version=1.6.0.26424, Culture=neutral, PublicKeyToken=8337224c9ad9e356">
<HintPath>..\packages\DllExport.1.6.0-beta\gcache\{0415A0AA-76E4-43A4-BDC3-D115A6781C7D}\DllExport.dll</HintPath>
<Private>False</Private>
</Reference> We also need information between each installation/removing or any API to manage our binaries and internal tools like IL Assembler etc. ! Well, I think you may continue dev_1.6 branch for adding alternatives via standard nuget ways (but only as additions to our new manager - anyway, it can be easily combined via commands to Wizard). dev_1.6 already contains ah yes, you can also contact with me via skype or email if you need private discussion. |
Happy to continue via email -- mine is oren at novotny dot org if you want shoot me a note. I have written many tools that use NuGet and package ref to do similar things. The trick is usually providing the right targets in the Here's an example of an older tool (no longer needed): https://github.com/onovotny/ReferenceGenerator. It runs purely as a build event to manipulate things during the build. There are no library references to it. For things where you need persistent local binaries, the easiest thing to do is to use the object directory variables like we do in Refit: https://github.com/paulcbetts/refit/blob/master/Refit/targets/refit.targets In that case, we write to I'll admit that I don't fully follow the flow of your toolchain, but I love that it works! See this thread for what I've been doing with it: https://twitter.com/onovotny/status/893960433119481856 :) The repo with the tooling using it is here https://github.com/onovotny/KeyVaultSignToolWrapper |
hmm, I think we are talking about different things :) I also have a few nuget packages that exactly uses
I don't see something like this at all when I use <Import Project="..\packages\DllExport.1.6.0-beta\build\net20\DllExport.targets" Condition="Exists('..\packages\DllExport.1.6.0-beta\build\net20\DllExport.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
...
</Target> Absolutely no any new
For something like this, I use vssbe that's being developed from 2013 and still perfectly for some crazy things with VS or msbuild :) This project also fully controlled by this. Anyone please note this.
Like a music for my ears ... that all works fine :p thanks for using :) |
That's because NuGet includes them automatically. NuGet does not touch the project file anymore. That doesn't mean they're not included :) If you look at the obj directory, you'll note that there are a few generated props/targets on restore...and they'll include your |
@onovotny I see, that's what I was looking for :) thanks
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)dllexport\1.6.0-beta\build\net20\DllExport.targets" Condition="Exists('$(NuGetPackageRoot)dllexport\1.6.0-beta\build\net20\DllExport.targets')" />
</ImportGroup> Good ! our Wizard already may control caching
by the way, the vssbe above was created initially with the same thoughts :) it serves all solution data without any modifications of projects files. |
Unfortunately it still contains a lot of problems for our project. Let me explain... In the morning I was thinking about same scheme like external <PropertyGroup Condition=" '$(ProjectGuid)' == '{36e28b5f-b075-4de7-85e5-d97d1be73f88}' ">
<DllExportNamespace>System.Runtime.InteropServices</DllExportNamespace>
...
</PropertyGroup>
<PropertyGroup Condition=" '$(ProjectGuid)' == '{0415A0AA-76E4-43A4-BDC3-D115A6781C7D}' ">
<DllExportNamespace>net.r_eg.DllExport</DllExportNamespace>
...
</PropertyGroup>
<ItemGroup>
<Reference Include="DllExport, Version=1.6.0.26424, Culture=neutral, PublicKeyToken=8337224c9ad9e356">
<HintPath>$(DllExportInstalledPath)\gcache\$(ProjectGuid)\DllExport.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
.... Looks good to avoid reloading environment outside EnvDTE logic etc., this I thought until I saw a hard coded logic for this type of references: failed.
<PackageReference Include="DllExport">
<Version>1.6.0-beta</Version>
</PackageReference> It will work only when That is, summary:
I'm still see many problems and inconveniences with this, i.e. I have some ideas but ... I want much more transparent logic for all this. Please note again, DllExport.dll library it's marker only that's actually does not contains any logic at all. We need this only for Cecil processing in attribute manner. Well, I think I will improve only preparing of our manager via std. nuget (we can standardize via But the transparent scheme is still as the removing package from official nuget clients, then to continue through our manager. Because I'm watching that NuGet project still is inconvenient for something like this project or this https://www.nuget.org/packages/vsSBE.CI.MSBuild/ etc. Did I miss something ? some API for control behavior of |
Couple things... To prevent
Also keep in mind that What I would suggest is to not have anything in the |
It's not possible anymore :) i.e. the package will not be installed at all if not exists any library in
For example, this is required by ddNS feature - #2 (e.g.: #47 )
That is, it will not be generated by VS when created new project o_O Can I see some official information etc. about this changes ? |
I don't have a link to the docs handy, but look at the "SDK style projects" and all of the clean-up they have been doing. Here's an example of an exe: I can say with certainty that it's possible to have packages that install but do not have a lib folder :) Newer clients have no problem with just a The idea here is that all of the logic is handled by your props and targets and you're just telling NuGet to install it and wire-it-up. Not sure what the real value is of dynamic namespaces? Most tools like this (including Roslyn based things), just pick a namespace and go with it. Only you can answer if it's worth the effort :) If the dll is a marker and gets removed, one option that may be easier could be code generation. Dynamically write a |
hmm, the interesting solution to forget about identifiers of projects at all <_< I thought that Maybe you know, what about Well, it doesn't matter for DllExport project, because we can also use other internal identifier for specific configured project. But for vssbe project it does :) thanks for the information.
Looks like a some alternatives, need to check, but I'm scared to use something undocumented from NuGet project. And I'm worry about availability for active std.nuget clients, and so on. How to say... I don't want new surprises from their projects. But I also see that an project now is more standardized in recent time.., hmm Does exist some official/authoritative information about this ?
No :) if I understand correctly your thought. DllExport.dll it's frontend as a marker for user space, and this attribute should be available at runtime for usage 'as is'. Today, as I know, roslyn does not provide any mechanism to reimplement this at runtime. I mean, of course we can fully generate IL via CodeDom compiler + reflection, etc. but we can't reimplement this like ValueTuples in C# 7 :) e.g.: https://github.com/3F/sandbox/blob/master/csharp/_core_features/Tuple_csharp7/ValueTuple.cs this is possible because it's already implemented by compiler to final implementation later. upd. project.assets.json: "DllExport/<version> {
"type": "package",
"compile": {
"lib/net20/_._": {}
},
"runtime": {
"lib/net20/_._": {}
},
"build": {
"build/net20/DllExport.targets": {}
}
} ugly hack, but yes, seems it works. need to think -_- any reliable and transparent way, because... |
Also fixes UI Wizard with incorrect position of already configured records in main form.
* NEW: The new lightweight manager & distribution via MvsSln & GetNuTool projects. Issue #38. Based on hMSBuild logic and includes GetNuTool core. Now you shouldn't use standard nuget clients anymore: https://www.youtube.com/watch?v=okPThdWDZMM Package from nuget.org already contains this, but you can also get it directly. Latest version: https://raw.githubusercontent.com/3F/DllExport/latest/manager/DllExport.bat ~18 Kb text-based embeddable batch-scripts that does not require powershell and dotnet-cli. To install/uninstall or to reconfigure your projects: `DllExport -action Configure` To manually restore package: `DllExport -action Restore` All available features: `DllExport -h` Server by default - nuget.org * NEW: The new Wizard (configurator via MvsSln). To easy configure your projects in any place. Issue #38. MvsSln v1.0.1.43422: https://github.com/3F/MvsSln * NEW: Added support of global namespaces - Issue #47. Use `Direct-Mod` if Cecil will not process this correctly. * FIXED: Fixed target platform detection. Issue #34. Details: #34 (comment) * FIXED: Fixed problem when the Post-Build event is triggered before our tool. Issue #35. Use this if still is needed: ``` <Target Name="PostBuildEventBeforeDllExport" BeforeTargets="DllExportMod"> ... </Target> ``` * FIXED: Fixed generation of exp + .lib via MS Library Manager for VS2017. Issue #37. Now it also includes processing through VsDevCmd & VcVarsAll initializer scripts. Use the folowing msbuild properties to override values by default: * $(DllExportVcVarsAll); $(DllExportVsDevCmd) * FIXED: Fixes possible problem with multiple properties that contains *Undefined* word, e.g.: *Undefined*\path1;C:\path2 ... * CHANGED: Added information about finding lib tool. Issue #44. * CHANGED: UI. Selected platform now affects to all configurations of project instead of active as before. * CHANGED: Now, nuget package does not contain library in `lib/.../` Details in #36. * CHANGED: Now, we also distribute .zip package for work through our manager etc. https://github.com/3F/DllExport/releases The latest text-based manager you can find here: https://raw.githubusercontent.com/3F/DllExport/latest/manager/DllExport.bat Illustration here: https://www.youtube.com/watch?v=okPThdWDZMM
@onovotny Actually, I left integration with It means that I have no plans for this today until I see some API or some other transparent way for support our important features. However, you or anyone else may try to integrate this with our new Wizard. I'll review your suggestions later. Yesterday has been released v1.6 beta2:
|
I'd be happy to try, but I'm not sure I entirely understand the gap between what |
There really should not be another package manager that pulls in files....I don't understand why this can't be self-contained like it is now?
Sent from a mobile device, please excuse brevity and typos
…________________________________
From: Denis Kuzmin <notifications@github.com>
Sent: Sunday, August 20, 2017 12:21:38 PM
To: 3F/DllExport
Cc: Oren Novotny; Mention
Subject: Re: [3F/DllExport] PackageReference support in VS 2017 (#36)
[dllexport_manager_and_nuget]<https://user-images.githubusercontent.com/3246589/29496502-84e62e0c-85dc-11e7-9ecf-2c95adc61b35.png>
Where L1 points to final communications with our manager.
we also need to avoid this:
[dllexport_dblref]<https://user-images.githubusercontent.com/3246589/29496464-ec03ff0c-85db-11e7-9e58-62b84f98185f.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#36 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABXHVFTA0j6GfW2bfZffzQFCXw5XVB21ks5saF0SgaJpZM4NSY58>.
|
@onovotny how you will control, for example, DllExport.dll metalibrary via PackageReference ? and also how you will execute our Wizard/Configurator ? For better support of our tool, now we provide embeddable manager, but it still doesn't matter, because we need to support our Configurator, and some other features, anyway. I mean, even without manager, you should communicate with our Wizard/Configurator. |
All the Wizard should do is add some properties to the MSBuild file, no? To invoke the wizard, you could easily have a target so a user would do PackageReference would control the |
:) If I correctly understand your thought, yes, it's not so important when it should be configured at install time or when build is started: Just try to install 1.6.0-beta2 package via Good ! we have the opportunity to configure all what we need :) we already discussed about this above, btw, I updated structure so, how we'll manage 2 or more different DllExport.dll ? I mean, does nuget provide some options to control path to library (see project.assets.json), how we'll update/replace this for Also, how about removing ? we have some configured data for specific projects, therefore we also need to remove this after removing our package. In general, I have some ideas, but... |
* NEW: The new embeddable lightweight manager for distribution via MvsSln & GetNuTool projects. Issue #38. Based on hMSBuild logic and includes GetNuTool core v1.6.1. Now you shouldn't use standard nuget clients anymore: https://www.youtube.com/watch?v=9bYgywZ9pPE Quick start: https://www.youtube.com/watch?v=sBWt-KdQtoc ============================== DllExport -action Configure ============================== Package from nuget.org already contains manager, but you can also get it directly. Latest manager: https://3F.github.io/DllExport/releases/latest/manager/ ~18 Kb text-based embeddable batch-script that does not require powershell and dotnet-cli. Automatic restoring still is available but you can also use: `DllExport -action Restore` All available features: `DllExport -h` Direct links to remote package (without nuget server) via `-pkg-link {uri}` key. Issue #53. NuGet Server by default: nuget.org. * NEW: The new Wizard (configurator via MvsSln). To easy configure your projects in any place. Part of Issue #38. MvsSln v2.0: https://github.com/3F/MvsSln * NEW: Added support of empty/global namespaces - Issue #47. Use `Direct-Mod` if Cecil will not process this correctly. * NEW: Implemented another storage for configuration: '.net.dllexport.targets'. Issue #49. * NEW: New settings for configurator (Wizard): * Path to custom ILAsm. * Flag to keep intermediate Files (IL Code, Resources, ...). * Timeout of execution in milliseconds. * NEW: Implemented automatic checking existence of a correct exported proc via Conari. Issue #55. Wizard controls it via `$(DllExportPeCheck)`: * 0x01 bit - Will check count of all planned exports from final PE32/PE32+ module. * 0x02 bit - Will check existence of all planned exports (IL code) in actual PE32/PE32+ module. * NEW: Implemented PE32/PE32+ Viewer to check manually available exports from final modules. Issue #55. New key for manager: ``` -pe-exp-list {module} - To list all available exports from PE32/PE32+ module. ``` Sample: ``` DllExport -pe-exp-list bin\Debug\regXwild.dll ``` * FIXED: Fixed target platform detection. Issue #34. Details: #34 (comment) * FIXED: Fixed problem when the Post-Build event is triggered before our tool. Issue #35. Use this if still is needed: ``` <Target Name="PostBuildEventBeforeDllExport" BeforeTargets="DllExportMod"> ... </Target> ``` * FIXED: Fixed generation of exp + .lib via MS Library Manager for VS2017. Issue #37. Now it also includes processing through VsDevCmd & VcVarsAll initializer scripts. Use the folowing msbuild properties to override values by default: * $(DllExportVcVarsAll); $(DllExportVsDevCmd) * FIXED: Fixes possible problem with multiple properties that contains *Undefined* word, e.g.: *Undefined*\path1;C:\path2 ... * CHANGED: Added information about finding lib tool. Issue #44. * CHANGED: UI. Selected platform now affects to all configurations of project instead of active as before. * CHANGED: Now nuget package does not contain library in `lib/.../` Details in #36. * CHANGED: Now we also distribute .zip package for work through our manager etc. https://github.com/3F/DllExport/releases * NOTE: How to avoid EXP0014: RunIlAsm. The library manager still cannot be found. https://www.youtube.com/watch?v=zUejJ4vUPGw Related Issue #44 * NOTE: Quick start (Configuring, Automatic restoring, Pe-Viewer): https://www.youtube.com/watch?v=sBWt-KdQtoc * NOTE: The latest text-based manager: https://3F.github.io/DllExport/releases/latest/manager/ Other versions you can find from GitHub Releases: * https://github.com/3F/DllExport/releases Or get it from nuget packages starting with v1.6+ * NOTE: PE-features via Conari v1.3.0 https://github.com/3F/Conari * KNOWN: Bug when - "Build successful but methods are not exported." Issue #59 For today, anyone else may also try to use https://github.com/3F/Conari to avoid similar @Genteure's problem. * DIFF(v1.6-RC): * FIXED: Wizard. Fixed incorrect layout for zh_CN Simplified Chinese (Thanks @Genteure). Issue #61 * FIXED: Fixes automatic restoring the package via msbuild. Issue #62
1.7 includes the following changes:
This, by the way, partially follows the first draft logic above #36 (comment) And I still think this is a good point for project like this. But anyone can open PR for actual review together! Let me know if anything else. Thanks for the suggestion, |
…ing. This also adds generating `lib` stubs: 3F/DllExport#36
19.00 Package #3: * NEW: Added support for .NET Core projects; netcoreapp and netstandard targeting. * NEW: Added `lib` stubs: 3F/DllExport#36 * CHANGED: Updated GetNuTool 1.8 https://github.com/3F/GetNuTool/releases/tag/1.8 * CHANGED: Updated hMSBuild 2.3 https://github.com/3F/hMSBuild/releases/tag/v2.3 * NOTE: An automated build of the 7z.Libs NuGet packages now is open source project: https://github.com/3F/7z.Libs
Projects in VS 2017 no longer use ps1 scripts for install/uninstall. They are not called.
Instead, a package can provide a
\build\<tfm>\packagename.targets
file that will automatically get imported. In this case, it'd be\build\net20\DllExport.targets
.The text was updated successfully, but these errors were encountered: