Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate project.json in %TEMP% rather than in install location #332

Merged
merged 1 commit into from
May 18, 2016

Conversation

chuckries
Copy link
Member

With this change we generate the project.json in %temp%\getclrdbg and
restore/publish from this directory into the final install directory. This
avoids having the project.json in the final install directory.

@chuckries
Copy link
Member Author

# create the temp folder if it does not exist
$TempPath = Join-Path -Path $env:TEMP -ChildPath "getclrdbg"
if (-not (Test-Path -Path $TempPath -PathType Container)) {
New-Item -ItemType Directory -Force -Path $TempPath
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you delete the folder if it exists? I'm a little concerned that the file gets cached somewhere I don't know about and may not realize the need to clean to get an update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way project.json is generated, it will be recreated each time this script is run, nothing is cached.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I see above it will override the contents regardless. Is there any other file that may be left behind that could be a problem? If not then no need to delete the folder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so.


In reply to: 63795897 [](ancestors = 63795897)

@gregg-miskelly
Copy link
Member

dotnet publish -r $RuntimeID -o $InstallPath

'dotnet publish' will create the directory if it doesn't exist?


Refers to: scripts/GetClrDbg.ps1:126 in 77c55ee. [](commit_id = 77c55ee, deletion_comment = False)

@chuckries
Copy link
Member Author

@gregg-miskelly yes.

@chuckries
Copy link
Member Author

dotnet publish -r $RuntimeID -o $InstallPath

yes.


In reply to: 220180314 [](ancestors = 220180314)


Refers to: scripts/GetClrDbg.ps1:126 in 77c55ee. [](commit_id = 77c55ee, deletion_comment = False)

New-Item -ItemType Directory -Force -Path $InstallPath
# create the temp folder if it does not exist
$TempPath = Join-Path -Path $env:TEMP -ChildPath "getclrdbg"
if (-not (Test-Path -Path $TempPath -PathType Container)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no point to having -PathType Container if you don't deal with having a file named 'getclrdbg'

@kelltrick
Copy link
Contributor

lgtm

@chuckries
Copy link
Member Author

Updated this to created a directory named from a new Guid under %temp% and also fixed an issue with giving the script a relative path as an install location. This should fix any caching/simultaneous use issues.

New-Item -ItemType Directory -Force -Path $InstallPath
# create the temp folder if it does not exist
$GuidString = [System.Guid]::NewGuid()
$TempPath = Join-Path -Path $env:TEMP -ChildPath $GuidString
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are going to do it this way (which sounds reasonable to me) you should probably also delete the directory at the end of the script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


In reply to: 63798580 [](ancestors = 63798580)

With this change we generate the project.json in %temp%\<guid> and
restore/publish from this directory into the final install directory. This
avoids having the project.json in the final install directory.
@chuckries chuckries force-pushed the getclrdbg-release branch from f750cf8 to 237affa Compare May 18, 2016 23:10
@chuckries chuckries merged commit 368f7eb into microsoft:getclrdbg-release May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants