Skip to content

NuGet during restore doesn't respect the same compat shims as MSBuild when running in VS 15 command prompt #3387

Closed

Description

@davkean

We're running into restore issues under VS 15 with the new installer.

Basically, we're importing MIcrosoft.VS.SDK.targets via:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\VSSDK\Microsoft.VsSDK.targets"/>

Under MSBuild.exe, this targets file will be looked for in two different paths:

C:\Program Files (x86)\Microsoft Visual Studio\VS15Preview\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK

-and-

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK (for compat)

It exists only in the former. Under NuGet.exe when running msbuild, this targets is looked under only in the compat path:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK

This causes our build to fail in the new installer environment. NuGet should be respecting the same compat shims as MSBuild.

See: dotnet/msbuild#954

Activity

  1. changed the title [-]NuGet during restore doesn't respect the same compat shims as MSBuild when running VS 15[/-] [+]NuGet during restore doesn't respect the same compat shims as MSBuild when running in VS 15 command prompt[/+] on Aug 30, 2016
  2. radical commented on Aug 30, 2016

    @radical

    nuget.exe.config would need to add the search paths like (taken from https://github.com/Microsoft/msbuild/blob/xplat/src/XMakeCommandLine/app.config )

    <configuration>
        <configSections>
          <section name="msbuildToolsets" type="Microsoft.Build.Evaluation.ToolsetConfigurationSection, Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </configSections>
    ...
    <msbuildToolsets default="15.0">
          <toolset toolsVersion="15.0">
            <projectImportSearchPaths>
              <searchPaths os="windows">
                <property name="MSBuildExtensionsPath" value="$(MSBuildProgramFiles32)\MSBuild"/>
                <property name="MSBuildExtensionsPath32" value="$(MSBuildProgramFiles32)\MSBuild"/>
                <property name="MSBuildExtensionsPath64" value="$(MSBuildProgramFiles32)\MSBuild"/>
              </searchPaths>
            </projectImportSearchPaths>
          </toolset>
    </msbuildToolsets>
    
    ...
    </configuration>
    

    The above sets the fallback search paths used for importing projects from $(MSBuildExtensionsPath). Any app hosting msbuild needs this to support the same search paths.

  3. Sarabeth-Jaffe-Microsoft commented on Aug 30, 2016

    @Sarabeth-Jaffe-Microsoft

    @radical The toolset which includes search paths is only loaded from msbuild.exe.config, so no need to add anything to nuget.exe.config.

  4. radical commented on Aug 30, 2016

    @radical

    Oh, I misunderstood then. I thought the program was hosting msbuild and so not running msbuild.exe .

  5. davkean commented on Aug 30, 2016

    @davkean
    Author

    This could be because NuGet is picking up the wrong/different version of MSBuild - and not the willow version. @Sarabeth-Jaffe-Microsoft Is there an environment variable to figure out what the "current" msbuild is?

  6. Sarabeth-Jaffe-Microsoft commented on Aug 31, 2016

    @Sarabeth-Jaffe-Microsoft

    @davkean There's no environment variable except for VSINSTALLDIR if you're in a VS command prompt. Willow provides a COM API that could be used to locate Willow and thus MSBuild.

  7. added this to the milestone on Sep 1, 2016
  8. rrelyea commented on Sep 1, 2016

    @rrelyea
    Contributor

    We are working to incorporate that COM API now. Assigning this bug to @drewgil, as he is doing that work.

  9. modified the milestones: , on Sep 22, 2016
  10. modified the milestones: 4.0 RC2, 4.0 RC on Oct 27, 2016
  11. modified the milestones: 4.0 RC2, 4.0 RC3 on Nov 29, 2016
  12. removed their assignment
    on Dec 20, 2016
  13. rrelyea commented on Jan 3, 2017

    @rrelyea
    Contributor

    @nkolev92 - With Drew's work finished to properly find msbuild.exe in VS 2017 installs, this should be fixed now. Can you please confirm?

  14. nkolev92 commented on Jan 4, 2017

    @nkolev92
    Member

    Looks good.

    Tested with:
    NuGet version: 4.0.0-RC3-2162
    OS version: Windows 10 RS1_Release 14393.693

  15. added
    Resolution:Duplicate
    on Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Product:NuGet.exeResolution:DuplicateType:Bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions