Code Monkey home page Code Monkey logo

Comments (6)

DavidBeaumier avatar DavidBeaumier commented on July 20, 2024

It looks like the expression got removed... here it is:

$simpleBadStuff = @"
<Import Project="`$(SolutionDir)\.nuget\nuget.targets" />
"@

from automaticpackagerestoremigrationscript.

DavidBeaumier avatar DavidBeaumier commented on July 20, 2024

I also noticed that the resulting vbproj files contains erroneous hintpath elements ($(SolutionDir)packages...). I thnik there's a missing "" in the hintPath replacement value. I think it should be like below.

$content = $content -replace $hintPathPattern, "<HintPath>`$(SolutionDir)\packages"

from automaticpackagerestoremigrationscript.

owen2 avatar owen2 commented on July 20, 2024

I like the idea from your first comment. Probably going to implement that. It's also interesting that your $(SolutionDir) doesn't end in a slash. Might need to add a check for that.

from automaticpackagerestoremigrationscript.

DavidBeaumier avatar DavidBeaumier commented on July 20, 2024

Not sure if the actual $(SolutionDir) ends or not with a , but when I look at other usages of this macro in the vbproj files I see Microsoft always add a \ after the macro.

I'm also investigating an issue where the element below don't get removed even if there's an expression for it in the script. I suspect the regex is too specific.

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable 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('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
  </Target>

from automaticpackagerestoremigrationscript.

DavidBeaumier avatar DavidBeaumier commented on July 20, 2024

Here's the solution I found to correctly remove the Target element:

$nugetBuildImportsPattern = @"
\s*<Target Name="EnsureNuGetPackageBuildImports".*?</Target>\s
"@
[...]
$content = [Regex]::Replace($content, $nugetBuildImportsPattern, "", @('Singleline', 'Ignorecase'))

from automaticpackagerestoremigrationscript.

owen2 avatar owen2 commented on July 20, 2024

this should be fixed in another pull request

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.