cake-build / cake-vs

Cake Extension for Visual Studio
https://marketplace.visualstudio.com/items?itemName=vs-publisher-1392591.CakeforVisualStudio
MIT License
67 stars 25 forks source link

Update Cake packages to 0.16.0 #11

Closed agc93 closed 7 years ago

agc93 commented 7 years ago

Includes fixes for #1180 API change in module template (cc @patriksvensson )

agc93 commented 7 years ago

@devlead Yes, unfortunately. Even the docs point out that your only options are (since we're bundling multiple templates), packaging in MSI and storing on disk, or storing inside the VSIX. It is really annoying but NuGet support in VS extensibility is very patchy.

I think there will be an alternative in future (should be possible to replace the default NuGet package wizard and bring the VS package manager in by MEF instead), but we decided that was a future avenue for improvement.

That answer your question?

devlead commented 7 years ago

@agc93 I was thinking about this GIT repo, couldn't we just restore them as part of build process?

agc93 commented 7 years ago

@devlead Ah, I get you now. Could be done, but we lose out of the box Visual Studio build then (since the project will be missing files on first clone), but that's probably not fatal. Obviously we would still need to be running against a specific version, but we do save having the actual nupkg in the repo..

devlead commented 7 years ago

If you have a project in solution that depends on the nuget and has 1st build priority then Visual Studio should auto restore those packages om first build.

agc93 commented 7 years ago

@devlead But none of the projects actually depend on the Cake packages, they're just included in the main project as content files, so that they're then packaged into the VSIX at a particular path.

devlead commented 7 years ago

@agc93 Well you can treat them as development dependencies I was able to get it to compile by adding below to src/packages.config

+  <package id="Cake.Core" version="0.15.2" targetFramework="net451" developmentDependency="true" />
+  <package id="Cake.Testing" version="0.15.2" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit" version="2.1.0" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit.abstractions" version="2.0.1" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit.assert" version="2.1.0" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit.core" version="2.1.0" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit.extensibility.core" version="2.1.0" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net451" developmentDependency="true" />
+  <package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net451" developmentDependency="true" />

and changing src/Cake.VisualStudio.csproj to

-    <Content Include="Packages\cake.core.0.15.2.nupkg">
+    <Content Include="..\packages\Cake.Core.0.15.2\Cake.Core.0.15.2.nupkg">
-    <Content Include="Packages\cake.testing.0.15.2.nupkg">
+    <Content Include="..\packages\Cake.Testing.0.15.2\Cake.Testing.0.15.2.nupkg">
-    <Content Include="Packages\xunit.2.1.0.nupkg">
+    <Content Include="..\Packages\xunit.2.1.0\xunit.2.1.0.nupkg">
-    <Content Include="Packages\xunit.runner.visualstudio.2.1.0.nupkg">
+    <Content Include="..\Packages\xunit.runner.visualstudio.2.1.0\xunit.runner.visualstudio.2.1.0.nupkg">
-    <Content Include="Packages\xunit.abstractions.2.0.1.nupkg">
+    <Content Include="..\Packages\xunit.abstractions.2.0.1\xunit.abstractions.2.0.1.nupkg">
-    <Content Include="Packages\xunit.assert.2.1.0.nupkg">
+    <Content Include="..\Packages\xunit.assert.2.1.0\xunit.assert.2.1.0.nupkg">
-    <Content Include="Packages\xunit.core.2.1.0.nupkg">
+    <Content Include="..\Packages\xunit.core.2.1.0\xunit.core.2.1.0.nupkg">
-    <Content Include="Packages\xunit.extensibility.core.2.1.0.nupkg">
+    <Content Include="..\Packages\xunit.extensibility.core.2.1.0\xunit.extensibility.core.2.1.0.nupkg">
-    <Content Include="Packages\xunit.extensibility.execution.2.1.0.nupkg">
+    <Content Include="..\Packages\xunit.extensibility.execution.2.1.0\xunit.extensibility.execution.2.1.0.nupkg">

Then it just restores the packages on first compile, it's 20MB of binaries and as versions are kept in git repo could grow allot. So if at all possible I think we should investigate if it's possible to avoid unnecessary binaries in the repo.

agc93 commented 7 years ago

Okay I'll try out what you've described there and make sure the VSIX still gets built as expected

agc93 commented 7 years ago

Initial indications aren't looking good as configuring the package as you point out does build the project correctly, but the packages are now in the VSIX at a different relative path and I'm not sure I can control that part fully. I will keep looking into it tomorrow and over the weekend and see if I can come up with some method of achieving what we want.

gep13 commented 7 years ago

Why would we lose Visual Studio build working? Could we not hook up the task explorer and assign the restore task to the pre-build event? I think someone created an extension for that?

devlead commented 7 years ago

@gep13 studio restores packages just fine, issue here it's that these packages are content not dependencies. But as restore works with my suggestion, we could potentially keep paths in csproj but have a prebuild action that copies the nupkgs from solution packages to project packages folder. Keeping same paths as when it worked.

agc93 commented 7 years ago

@devlead @gep13 That was what I was going to try next (pre-build xcopy), but it just felt a bit dodgy for some reason. I'm going to see if I can get VS to discover the packages in their new location first, then fall back to that if I can't work it out

agc93 commented 7 years ago

I've created #12 to address getting the packages out of the repo, so we can address that issue independently of getting the 0.16.0 changes put in, as it won't be a quick fix.

gep13 commented 7 years ago

@agc93 said... I've created #12 to address getting the packages out of the repo, so we can address that issue independently of getting the 0.16.0 changes put in, as it won't be a quick fix.

this sounds like a good idea to me!