Repository navigation
Closed
Labels
Description
convert-from-nuget (as of 0.4.9.0) converts nuget binary references to a bunch of <When>/<Reference>.
This is pretty bad imho:
- changing dependencies implies modifying project file
- there is no reason to store such information inside the csproj as this can be generated from scratch using package definition when installing/restoring packages
Well, something like that in a project referencing Rx would then be modified as follow:
<Import Project="$(SolutionDir)\.paket\paket.targets" />
<Import Project="$(SolutionDir)\packages\Rx-Core\Paket.targets" />
<Import Project="$(SolutionDir)\packages\Rx-Interfaces\Paket.targets" />
<Import Project="$(SolutionDir)\packages\Rx-Linq\Paket.targets" />
and a generated file for Rx-Core could be (sitting inside packages\pkg-name\Paket.targets):
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
<ItemGroup>
<Reference Include="System.Reactive.Core">
<HintPath>$(SolutionDir)\packages\Rx-Core\lib\Net40\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.5'">
<ItemGroup>
<Reference Include="System.Reactive.Core">
<HintPath>$(SolutionDir)\packages\Rx-Core\lib\Net45\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework'">
<ItemGroup>
<Reference Include="System.Reactive.Core">
<HintPath>$(SolutionDir)\packages\Rx-Core\lib\Net45\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == 'Silverlight' And $(SilverlightVersion) == 'v5.0'">
<ItemGroup>
<Reference Include="System.Reactive.Core">
<HintPath>$(SolutionDir)\packages\Rx-Core\lib\SL5\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == 'Silverlight'">
<ItemGroup>
<Reference Include="System.Reactive.Core">
<HintPath>$(SolutionDir)\packages\Rx-Core\lib\SL5\System.Reactive.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>
Activity
[-]convert-from-nuget should create .targets for importing nugget binaries[/-][+]convert-from-nuget should create .targets for importing nuget binaries[/+]agross commentedon Sep 29, 2014
A little formatting helped me understand what you were getting at! Sounds like a good idea to me! 👍
forki commentedon Sep 29, 2014
👍 I second that.
I think it's a really great idea and it gives real advantages:
paket updatewill have at least one diff and that's in the lockfile. exactly where it belongs. and that's even if the libs folder in the package changes. That's awesome!forki commentedon Sep 29, 2014
rojepp commentedon Sep 29, 2014
This change does sound nice, but it has me worried. I know I've had to modify .*proj files manually, but I can't think of a single example right now.
How does this work for JS libs for web sites?
forki commentedon Sep 29, 2014
we still would not touch any manual installations.
It's not in this sample, but paket adds marker sub-nodes to indicate "I was installed by paket". If Paket finds nodes to a dll without the marker we skip it.
Very good point. I'd like to hear others about that.
(related: there are people who think it's not a good idea to use nuget for js libs - #199. Please don't discuss the general issue here. Just interested in where to put content installations)
pchalamet commentedon Sep 30, 2014
It is possible to use a Condition attribute on the import. This would be possible to discover Paket's imports then:
forki commentedon Sep 30, 2014
If we use paket.targets as file names then this should be enough
dedale commentedon Sep 30, 2014
Good idea Pierre, I told something similar to Steffen a couple of days ago, but it's way better to open an issue with samples :-)
ctaggart commentedon Oct 2, 2014
I really like this idea of using
paket.targetsfiles!forki commentedon Oct 2, 2014
@ilkerde what do you think about this?
forki commentedon Oct 6, 2014
there are still open questions:
During installation we would add <Import Project="..."
/>to the proj file.The referenced targets file will not be commited (right?).
If we clone a repo and the packages folder is empty the targets file is missing. I assume VS will not load the project. That would be a showstopper.
If we update the targets file (new version installed or something like that) we create no change in the proj file. VS will not reload.
ctaggart commentedon Oct 6, 2014
Just add a
Conditionfor if thepaket.targetsfileExists. NuGet does this:This will allow Visual Studio to load the project if the file is missing.
forki commentedon Oct 6, 2014
sounds good.
ilkerde commentedon Oct 12, 2014
@forki I'm really thinking hard about it. I also try to do this by hand, but it doesn't seem to work. I have VS2013 and a simple sln/csproj, tried to externalize a package reference as @pchalamet describes, but VS doesn't seem to recognize the ref at all. Any hints on how to get a working sample?
forki commentedon Oct 12, 2014
No sorry. I didn't look into this very deeply.
On Oct 12, 2014 11:47 AM, "ilkerde" [email protected] wrote:
ilkerde commentedon Oct 12, 2014
I'll try to get a working sample, but all my efforts so far (VS2013 + VS2012 with simple sln/csproj referencing our beloved Newtonsoft.Json) failed. @pchalamet Maybe you can provide us with a working sample?
pchalamet commentedon Oct 12, 2014
I have a hackish patch sitting there: https://github.com/pchalamet/Paket/tree/targets
Got this for one of my project and it does compile and is correctly seen by VS13.
Note that Imports must be under
<Project>.for a csproj referencing Rx:
And Rx-Core's Paket.targets:
pchalamet commentedon Oct 12, 2014
Btw, I failed to make it work for Moq package (work for other packages) - that is why I've not attempt a PR (and some clean up has to be done anyway). My test project is https://github.com/pchalamet/cassandra-sharp (have to keep only net45 solution and add MinimumVSver otherwise Paket badly breaks).
agross commentedon Oct 12, 2014
Can you please elaborate on the "breaking badly" part?
(insert animated gif of Walter White here)
Alex
Alexander Groß
Tiny phone, tiny mail
On Sun, Oct 12, 2014 at 2:45 PM, Pierre Chalamet [email protected]
wrote:
pchalamet commentedon Oct 12, 2014
SolutionFile::AddPaketFolder() requires MinimumVisualStudioVersion.
theimowski commentedon Oct 13, 2014
MinimumVisualStudioVersionshould have been fixed in #221.forki commentedon Oct 13, 2014
Close this?
On Oct 13, 2014 12:06 PM, "Tomasz Heimowski" [email protected]
wrote:
pchalamet commentedon Oct 13, 2014
Probably. I've not rebased since few days. I will try to rebuild the patch for *.targets.
pchalamet commentedon Nov 3, 2014
I won't try to patch Paket anymore as I have implemented my own package manager; I'm now able to reference packages as targets files. Much better indeed.
ctaggart commentedon Nov 3, 2014
:( I've really been looking forward to this feature. It is one that I've marked as required for us to upgrade from
0.8.5. It has several benefits that will increase adoption and reduce friction.Merge pull request #197 from fsprojects/init-git