Skip to content

Don't hardcode NuGet source #2076

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

Merged
merged 3 commits into from
Jul 12, 2018
Merged

Don't hardcode NuGet source #2076

merged 3 commits into from
Jul 12, 2018

Conversation

bdukes
Copy link
Contributor

@bdukes bdukes commented May 25, 2018

With a clean clone, there are still issues running ./Build_Install_Package.bat, the first of which is an error resolving the new ClientDependency NuGet package from #2068. Currently, this PR fixes that NuGet issue by adjusting the nuget restore call done in the build process to use the nuget.config file instead of passing a -Source URL directly.

At this point, I'm now getting errors from the DotNetNuke.Modules.DDRMenu and DotNetNuke.Modules.HtmlEditorManager projects:

C:\Code\Dnn.Platform\Platform.testtest\DNN Platform\Modules\DDRMenu\DotNetNuke.Modules.DDRMenu.csproj(205,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

@bdukes
Copy link
Contributor Author

bdukes commented May 25, 2018

So, it looks like on my local machine, that file should be found from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications instead of C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets, which ultimately stems from using C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe instead of C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe to run this process.

Currently, when building packages, the script attempts to find msbuild in this order:

  1. %ProgramFiles(x86)%\MSBuild\15.0\Bin\MSBuild.exe
  2. %ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
  3. %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
  4. %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe
  5. %ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

I propose that if there is an msbuild available in the environment, we should use that, otherwise it should look for the version bundled with Visual Studio before the standalone MSBuild. I don't know that any scenario is foolproof, unless maybe we search specifically for Microsoft.WebApplication.targets under the path before we settle on one?

Thoughts @tpluscode @galatrash @ahoefling @mitchelsellers?

@galatrash
Copy link
Contributor

This is tricky abit. When I created this batch file I tried under different environment but was not exhaustive. I didn't want to look in the registry which requires elevated rights; I wanted it to be simple CLI job. If you have a better way to do it, please do and submit a PR.

@@ -140,7 +140,7 @@
</Target>

<Target Name="NugetRestore">
<Exec Command="$(PlatformCheckout)\.nuget\NuGet.exe restore &quot;$(PlatformCheckout)\DNN_Platform.sln&quot; -Source https://api.nuget.org/v3/index.json"/>
<Exec Command="$(PlatformCheckout)\.nuget\NuGet.exe restore &quot;$(PlatformCheckout)\DNN_Platform.sln&quot;"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact the used sources are already added in the "$(PlatformCheckout)\.nuget\NuGet.Config file. So, this change is ok.

@SkyeHoefling
Copy link
Contributor

@bdukes :

I propose that if there is an msbuild available in the environment, we should use that, otherwise it should look for the version bundled with Visual Studio before the standalone MSBuild. I don't know that any scenario is foolproof, unless maybe we search specifically for Microsoft.WebApplication.targets under the path before we settle on one?

I agree that we should pull msbuild out of the environment. We should pick a minimum version of visual studio and support that version to the latest.

I have always found it weird that the script looks for a particular version of msbuild and tries to fall through to the next. I'm sure there was a great reason for it but this has the potential to cause a lot of build side-effects.

  • For example what do you do if someone installs Visual Studio into a non-standard path?

@bdukes
Copy link
Contributor Author

bdukes commented May 30, 2018

I pushed the change to the build scripts which uses the MSBuild available in the environment, and only looks in those specific paths if it isn't defined. I think there may still be something off with the script, because it generates /Build/BuildScritps/_Install.zip instead of /Artifacts/DNN_Platform_9.2.1.123-456_Install.zip, but it's closer

@ohine ohine added the Community Legacy label used to identify community contributions label Jun 4, 2018
@ohine ohine self-requested a review June 4, 2018 00:40
Copy link
Contributor

@ohine ohine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good to me, hopefully it'll get us closer to consistent builds across different environments. Thanks @bdukes for submitting the pull request!

@dnfclas
Copy link

dnfclas commented Jul 6, 2018

CLA assistant check
All CLA requirements met.

@bdukes bdukes changed the base branch from clientdependency-remnanats to development July 6, 2018 20:55
@bdukes
Copy link
Contributor Author

bdukes commented Jul 6, 2018

This has been approved by two reviewers, is there anything holding up a merge?

@ohine ohine merged commit 630fe45 into development Jul 12, 2018
@tpluscode tpluscode deleted the fix-clean-build branch July 17, 2018 05:04
@ohine ohine added this to the 9.2.2 milestone Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Legacy label used to identify community contributions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants