Code Monkey home page Code Monkey logo

Comments (4)

owen2 avatar owen2 commented on July 20, 2024

I don't think xunit should be doing that to your projects. VS or TFS or nuget.exe restore will still restore packages even with this removed. Xunit adding this to your project could actually end up breaking your projects. I'll try to look into this a bit more later.

from automaticpackagerestoremigrationscript.

sliekens avatar sliekens commented on July 20, 2024

It turns out that this is not at all specific to xunit.

When you author a package that contains one (or both) of:

  • build\{packageid}.props
  • build\{packageid}.targets

For example: BuildPackage.1.0.0.nupkg

  • build\BuildPackage.props
  • build\BuildPackage.targets

NuGet automatically adds imports for those files to projects that you install the package into.

<Import Project="..\packages\BuildPackage.1.0.0\build\BuildPackage.props" Condition="Exists('..\packages\BuildPackage.1.0.0\build\BuildPackage.props')" />
<Import Project="..\packages\BuildPackage.1.0.0\build\BuildPackage.targets" Condition="Exists('..\packages\BuildPackage.1.0.0\build\BuildPackage.targets')" />

NuGet also adds an extra target named EnsureNuGetPackageBuildImports.

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
  <Error Condition="!Exists('..\packages\BuildPackage.1.0.0\build\BuildPackage.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\BuildPackage.1.0.0\build\BuildPackage.props'))" />
  <Error Condition="!Exists('..\packages\BuildPackage.1.0.0\build\BuildPackage.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\BuildPackage.1.0.0\build\BuildPackage.targets'))" />
</Target>

This is completely automatic and inevitable.

from automaticpackagerestoremigrationscript.

owen2 avatar owen2 commented on July 20, 2024

Does removing the section break xunit?

from automaticpackagerestoremigrationscript.

sliekens avatar sliekens commented on July 20, 2024

It doesn't break xunit (or other packages) because the <Import /> elements are left intact.

The only thing EnsureNuGetPackageBuildImports does is fail the build early and print a friendly message when the files in the <Import /> elements are missing. It doesn't hurt to remove it.

from automaticpackagerestoremigrationscript.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.