You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Running executable from a NuGet package with PackageReference management format #5975
I have a code base and two project files that target two versions of the .NET framework. Since I have them stored in the same folder I cannot rely on a Packages.config file since it will always incorporate one framework version and not the other. Thus I moved to PackageReference which worked great so far.
Unfortunately I just installed Mono.TextTemplating and wanted to execute the provided TextTransform.exe as a pre-build event on all of my *.tt files however I cannot reference it properly since it is stored under %userprofile%\.nuget\packages\mono.texttemplating\1.3.1\. The moment I update the package and forget about it, it will break since the new version will be stored under a different folder. Similiar to any changes of the local package storage.
How am I supposed to include executables from NuGet packages into my build steps now?
Details about Problem
NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): VS UI
NuGet version (x.x.x.xxx): 4.3
VS version (if appropriate): Enterprise 2017 (15.3.5)
OS version (i.e. win10 v1607 (14393.321)): Windows 10 v1703 (15063.608)
We actually have the same requirement, and were greatly surprised to see there's no easy to find solution (and we searched pretty hard). Two scenarios:
Running nunit3.console.exe requires either installing nunit, copying it in the git repo directly, or hardcoding the "expected" NuGet path from the user folder. All three prevents two projects referencing different versions of nunit which may not be compatible with the same nunit3.console.exe runner. (NOTE: Using dotnet test would be an alternative in that specific scenario)
Running FluentMigrator's Migrate.exe. same thing
A simple solution would be to have tools available in PackageReference/IncludeAssets. I guess it would be in ExcludeAssets by default, but we could then have the folder copied to the output folder and move on.
Another solution could be to specify "additional files", which would be a simple mapping of files from the package and where we want them (e.g. globbing pattern). Dirtier, but I could then select the files I want in /tools rather than always copy everything.
Finally, like @rrelyea said if we can get a variable to find the resolved package folder in a post-build event, we'd be good to go. Example of what that could look like:
Activity
rrelyea commentedon Oct 2, 2017
Great scenario. @mishra14 is looking into similar issues with bootstrapping using PackageReference.
rrelyea commentedon Oct 2, 2017
Great info. Thanks. I wasn't aware of that feature.
Clearly we should improve the build side of this.
Today, some tools set a msbuild property in their .props file, that consumers of that tool could use.
You could imagine that we create msbuild props for every tools folder that you restore. $(PackageToolsDir_My_Package_Name) or the like...
christianrondeau commentedon May 16, 2018
We actually have the same requirement, and were greatly surprised to see there's no easy to find solution (and we searched pretty hard). Two scenarios:
nunit3.console.exerequires either installingnunit, copying it in the git repo directly, or hardcoding the "expected" NuGet path from the user folder. All three prevents two projects referencing different versions ofnunitwhich may not be compatible with the samenunit3.console.exerunner. (NOTE: Usingdotnet testwould be an alternative in that specific scenario)FluentMigrator'sMigrate.exe. same thingA simple solution would be to have
toolsavailable inPackageReference/IncludeAssets. I guess it would be inExcludeAssetsby default, but we could then have the folder copied to the output folder and move on.Another solution could be to specify "additional files", which would be a simple mapping of files from the package and where we want them (e.g. globbing pattern). Dirtier, but I could then select the files I want in
/toolsrather than always copy everything.Finally, like @rrelyea said if we can get a variable to find the resolved package folder in a post-build event, we'd be good to go. Example of what that could look like:
rrelyea commentedon Jun 14, 2018
Resolving dupe of this issue: #6949 which is in flight.