Skip to content

Commit 42d1881

Browse files
committed
Fix UpdateRootNamespace path
1 parent 4c24cc5 commit 42d1881

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ Update-Module -Name "dual-projects" -RequiredVersion "1.1.0" -Force
191191
192192
# List installed modules
193193
Get-InstalledModule -Name "dual-projects"
194+
195+
# Uninstall the module
196+
Uninstall-Module -Name "dual-projects" -AllVersions
194197
```
195198

196199
## Other info (notes to self)

dotnet-new/dual-projects/dual-projects.psm1

+17-7
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,23 @@ function Add-FunctionalTests {
161161
}
162162
}
163163

164+
function outputLocation { return (get-location)}
165+
164166
function UpdateRootNamespace($projectName, $testProjectPath, $customPropsFile = $null) {
167+
$loc = outputLocation
168+
Write-Debug "Location: $loc"
169+
Write-Debug "testProjectPath: $testProjectPath"
170+
171+
# Convert to absolute path
172+
$fullTestPath = "$loc\$testProjectPath"
173+
Write-Verbose "Convert '$fullTestPath' to absolute '$fullTestPath'."
174+
165175
$i = 0;
166-
$tmpFile = "$testProjectPath.tmp"
167-
foreach ($line in [System.IO.File]::ReadLines($testProjectPath)) {
176+
$tmpFile = "$fullTestPath.tmp"
177+
foreach ($line in [System.IO.File]::ReadLines($fullTestPath)) {
168178
if ($i -eq 1) {
169179
if ($customPropsFile) {
170-
Write-Verbose "Adding '$customPropsFile' to '$testProjectPath'."
180+
Write-Verbose "Adding '$customPropsFile' to '$fullTestPath'."
171181
Add-Content -Path $tmpFile -Value " <Import Project=""$customPropsFile"" />"
172182
Add-Content -Path $tmpFile -Value ""
173183
}
@@ -183,12 +193,12 @@ function UpdateRootNamespace($projectName, $testProjectPath, $customPropsFile =
183193
}
184194

185195
# Delete original csproj
186-
Write-Verbose "Deleting '$testProjectPath'."
187-
Remove-Item –path $testProjectPath
196+
Write-Verbose "Deleting '$fullTestPath'."
197+
Remove-Item –path $fullTestPath
188198

189199
# Rename .csproj.tmp to .csproj
190-
Write-Verbose "Renaming '$tmpFile' to '$testProjectPath'."
191-
Move-Item -Path $tmpFile -Destination $testProjectPath
200+
Write-Verbose "Renaming '$tmpFile' to '$fullTestPath'."
201+
Move-Item -Path $tmpFile -Destination $fullTestPath
192202
}
193203
function BuildSolution($solutionName) {
194204
if ($solutionName) {

0 commit comments

Comments
 (0)