Merge pull request #7344 from mishra14/dev-anmishr-gracefulexception
Improving UX for dotnet add package when Path.GetTempPath throws
This commit is contained in:
commit
1c5908efa0
15 changed files with 80 additions and 2 deletions
|
@ -162,4 +162,7 @@
|
||||||
<data name="CmdPackageDirectory" xml:space="preserve">
|
<data name="CmdPackageDirectory" xml:space="preserve">
|
||||||
<value>PACKAGE_DIRECTORY</value>
|
<value>PACKAGE_DIRECTORY</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CmdDGFileIOException" xml:space="preserve">
|
||||||
|
<value>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -66,8 +66,18 @@ namespace Microsoft.DotNet.Tools.Add.PackageReference
|
||||||
|
|
||||||
if (!_appliedCommand.HasOption("no-restore"))
|
if (!_appliedCommand.HasOption("no-restore"))
|
||||||
{
|
{
|
||||||
// Create a Dependency Graph file for the project
|
|
||||||
tempDgFilePath = Path.GetTempFileName();
|
try
|
||||||
|
{
|
||||||
|
// Create a Dependency Graph file for the project
|
||||||
|
tempDgFilePath = Path.GetTempFileName();
|
||||||
|
}
|
||||||
|
catch (IOException ioex)
|
||||||
|
{
|
||||||
|
// Catch IOException from Path.GetTempFileName() and throw a graceful exception to the user.
|
||||||
|
throw new GracefulException(string.Format(LocalizableStrings.CmdDGFileIOException, projectFilePath));
|
||||||
|
}
|
||||||
|
|
||||||
GetProjectDependencyGraph(projectFilePath, tempDgFilePath);
|
GetProjectDependencyGraph(projectFilePath, tempDgFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">NOME_PACCHETTO</target>
|
<target state="translated">NOME_PACCHETTO</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">NAZWA_PAKIETU</target>
|
<target state="translated">NAZWA_PAKIETU</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
|
@ -77,6 +77,11 @@
|
||||||
<target state="translated">PACKAGE_NAME</target>
|
<target state="translated">PACKAGE_NAME</target>
|
||||||
<note />
|
<note />
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="CmdDGFileIOException">
|
||||||
|
<source>Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</source>
|
||||||
|
<target state="new">Unable to generate a temporary file for project '{0}'. Cannot add package reference. Please clear the temp directory and try again.</target>
|
||||||
|
<note />
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
Loading…
Add table
Add a link
Reference in a new issue