Skip to content
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

Allow external Nuget if already in path? #38

Closed
paschott opened this issue Sep 25, 2018 · 12 comments
Closed

Allow external Nuget if already in path? #38

paschott opened this issue Sep 25, 2018 · 12 comments

Comments

@paschott
Copy link
Contributor

We have a deployment server that's locked down to prevent downloading a copy of nuget to the working path. Nuget is already in the path. Would it be possible to override the functionality that tries to download Nuget to allow for using one already in the system path?

@RichieBzzzt
Copy link
Owner

RichieBzzzt commented Sep 26, 2018

You mentioned system path but just to confirm: the path stored as a system environment variable, as opposed to a user environment variable?
image

@paschott
Copy link
Contributor Author

paschott commented Sep 26, 2018 via email

@RichieBzzzt
Copy link
Owner

RichieBzzzt commented Sep 26, 2018

Ok this is 2 separate things:

  1. w/r/t nuget in environment path var - this is doable. Had a little play around earlier in PowerShell. I'd need to write a new function and test, so I reckon I can get this done, maybe tomorrow evening.
    2)check your sqlproj file. Read this post

https://bzzzt.io/post/2016-03-08-how-to-compile-sqlproj-files-using-cmdline-msbuild----errors-included-/

You may need to open up your sqlproj file and do some editing: altering where it finds the .targets file. This is form a recent project. Is your database project particularly old? Older projects don't work well with the Microsoft.Data.Tools.MSBuild because the path was different.

 <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
    <!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
    <SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
    <VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
  </PropertyGroup>
  <Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
  <Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />

The targets file is by defauly packaged in the Microsoft.Data.Tools.MSBuild nuget package, hence why it is used when building a project -

https://github.com/RichieBzzzt/PoshSSDTBuildDeploy/blob/master/PoshSSDTBuildDeploy/Functions/InvokeMSBuildSSDT.ps1#L38

@paschott
Copy link
Contributor Author

paschott commented Sep 26, 2018 via email

@RichieBzzzt
Copy link
Owner

No worries. Once the new function is in you won't need to download nuget from the web.

BTW, how will you download msbuild.data.tools if you have no internet connection? Or is it just no connection to download nuget?

@paschott
Copy link
Contributor Author

paschott commented Sep 26, 2018 via email

@RichieBzzzt
Copy link
Owner

OK gotcha no worries.

@RichieBzzzt
Copy link
Owner

Ok I’ve made a start and checked in a branch with a quick change to allow path to nuget to be added. But now my daughter’s sick and my tests are failing so I won’t get to finish tonight!

2nd phase is to add a switch to check user/system path, but am worried that might end up a bit flakey. Time will tell......

Hopefully over the weekend I can steal some time to complete.

@paschott
Copy link
Contributor Author

paschott commented Sep 27, 2018 via email

@RichieBzzzt
Copy link
Owner

RichieBzzzt commented Sep 30, 2018

OK ability to specify nuget location added and merged in and latest available on GitHub/NuGet. PowerShell Gallery is proving impossible to update, due to it whinging about something.

Now available on PSGallery.

@paschott
Copy link
Contributor Author

paschott commented Oct 2, 2018 via email

@RichieBzzzt
Copy link
Owner

Closed as of #40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants