Comments (6)
It looks like the expression got removed... here it is:
$simpleBadStuff = @"
<Import Project="`$(SolutionDir)\.nuget\nuget.targets" />
"@
from automaticpackagerestoremigrationscript.
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.
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.
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.
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.
this should be fixed in another pull request
from automaticpackagerestoremigrationscript.
Related Issues (12)
- Cant get this work when its using \s HOT 7
- xUnit.net compatible? HOT 4
- Remove blank lines at the end of project files
- Doesn't remove <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> HOT 1
- Solution files are saved using the "UTF-8" encoding which cause issues when re-opening them using the Visual Studio Version Selector HOT 1
- Can I specific to a folder
- RedirectionNotSupported ? HOT 1
- out-file is producing two empty new lines at the end of csproj file in fixHintPath.ps1 HOT 1
- The regular expression pattern ... is not valid HOT 2
- Entry point? HOT 2
- Script doesn't remove <RestorePackages> line from project files. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from automaticpackagerestoremigrationscript.