Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/NuGet.BuildTasks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Mishra <anmishr@microsoft.com>2018-05-23 21:11:22 +0300
committerAnkit Mishra <anmishr@microsoft.com>2018-05-31 01:26:30 +0300
commit7a6752c4f2e2bdbdd65796a182c0b5de0b433976 (patch)
tree88915ba12795e3738cbca94099d2b2b8b1bd0d54
parentf09d4fbe6a8fbda0f81e81b308bc421d1715fc08 (diff)
Address PR feedback
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj1
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs6
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs20
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs51
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Strings.resx36
5 files changed, 67 insertions, 47 deletions
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj b/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj
index bb643d5..270ee06 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj
@@ -10,7 +10,6 @@
<RootNamespace>Microsoft.NuGet.Build.Tasks.Tests</RootNamespace>
<AssemblyName>Microsoft.NuGet.Build.Tasks.Tests</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
- <RuntimeIdentifiers>win</RuntimeIdentifiers>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SignAssembly>true</SignAssembly>
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
index d8a3404..4990535 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
@@ -132,7 +132,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
allowFallbackOnTargetSelection: false,
isLockFileProjectJsonBased: false));
- Assert.Equal(nameof(Strings.MissingRuntimeIdentifierInCsproj), exception.ResourceName);
+ Assert.Equal(nameof(Strings.MissingRuntimeIdentifierInProjectFile), exception.ResourceName);
Assert.Equal(new[] { "missing-runtime-identifier", "missing-runtime-identifier" }, exception.MessageArgs);
}
}
@@ -184,7 +184,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
allowFallbackOnTargetSelection: false,
isLockFileProjectJsonBased: false));
- Assert.Equal(nameof(Strings.MissingFrameworkInCsproj), exception.ResourceName);
+ Assert.Equal(nameof(Strings.MissingFrameworkInProjectFile), exception.ResourceName);
Assert.Equal(new[] { "Missing,Version=1.0" }, exception.MessageArgs);
}
}
@@ -228,7 +228,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
[Theory]
[InlineData(true, nameof(Strings.NoTargetsInLockFileForProjectJson))]
- [InlineData(false, nameof(Strings.NoTargetsInLockFileForCsproj))]
+ [InlineData(false, nameof(Strings.NoTargetsInLockFileForProjectFile))]
public static void TestReferenceResolutionWithMissingTargets(bool isProjectJsonBased, string errorResourceName)
{
var lockFile = GenerateLockFileWithoutTarget();
diff --git a/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs b/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
index 2f8bcda..4ab972b 100644
--- a/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
+++ b/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
@@ -217,7 +217,11 @@ namespace Microsoft.NuGet.Build.Tasks
{
if (!_fileExists(ProjectLockFile))
{
- throw new ExceptionFromResource(nameof(Strings.LockFileNotFound), ProjectLockFile);
+ var errorMessage = IsLockFileProjectJsonBased(ProjectLockFile) ?
+ nameof(Strings.LockFileNotFoundForProjectJson) :
+ nameof(Strings.LockFileNotFoundForProjectFile);
+
+ throw new ExceptionFromResource(errorMessage, ProjectLockFile);
}
JObject lockFile;
@@ -719,7 +723,7 @@ namespace Microsoft.NuGet.Build.Tasks
{
var noTargetsInLockFileErrorString = IsLockFileProjectJsonBased(ProjectLockFile) ?
nameof(Strings.NoTargetsInLockFileForProjectJson) :
- nameof(Strings.NoTargetsInLockFileForCsproj);
+ nameof(Strings.NoTargetsInLockFileForProjectFile);
throw new ExceptionFromResource(noTargetsInLockFileErrorString);
}
@@ -728,8 +732,8 @@ namespace Microsoft.NuGet.Build.Tasks
{
var runtimePiece = RuntimeIdentifier;
var runtimesSection = $"<{RuntimeIdentifiersProperty}>{RuntimeIdentifier}</{RuntimeIdentifiersProperty}>";
- var missingRuntimeInRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierInCsproj);
- var missingRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierPropertyInCsproj);
+ var missingRuntimeInRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierInProjectFile);
+ var missingRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierPropertyInProjectFile);
if (IsLockFileProjectJsonBased(ProjectLockFile))
{
@@ -772,7 +776,7 @@ namespace Microsoft.NuGet.Build.Tasks
{
var missingFrameworkErrorString = IsLockFileProjectJsonBased(ProjectLockFile) ?
nameof(Strings.MissingFrameworkInProjectJson) :
- nameof(Strings.MissingFrameworkInCsproj);
+ nameof(Strings.MissingFrameworkInProjectFile);
ThrowExceptionIfNotAllowingFallback(missingFrameworkErrorString, TargetMonikers.First().ItemSpec);
}
@@ -987,7 +991,11 @@ namespace Microsoft.NuGet.Build.Tasks
if (libraryObject == null)
{
- throw new ExceptionFromResource(nameof(Strings.MissingPackageInTargetsSection), package.Key);
+ var errorMessage = IsLockFileProjectJsonBased(ProjectLockFile) ?
+ nameof(Strings.MissingPackageInTargetsForProjectJson) :
+ nameof(Strings.MissingPackageInTargetsSectionForProjectFile);
+
+ throw new ExceptionFromResource(errorMessage, package.Key);
}
// If this is a project then we need to figure out it's relative output path
diff --git a/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs b/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
index 97b00ae..0056db5 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
+++ b/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
@@ -70,20 +70,29 @@ namespace Microsoft.NuGet.Build.Tasks {
}
/// <summary>
+ /// Looks up a localized string similar to Assets file {0} couldn&apos;t be found. Run a NuGet package restore to generate this file..
+ /// </summary>
+ internal static string LockFileNotFoundForProjectFile {
+ get {
+ return ResourceManager.GetString("LockFileNotFoundForProjectFile", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Lock file {0} couldn&apos;t be found. Run a NuGet package restore to generate this file..
/// </summary>
- internal static string LockFileNotFound {
+ internal static string LockFileNotFoundForProjectJson {
get {
- return ResourceManager.GetString("LockFileNotFound", resourceCulture);
+ return ResourceManager.GetString("LockFileNotFoundForProjectJson", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Your project does not reference &quot;{0}&quot; framework. Add a reference to &quot;{0}&quot; in the &quot;TargetFrameworks&quot; property of your project csproj file and then re-run NuGet restore..
+ /// Looks up a localized string similar to Your project does not reference &quot;{0}&quot; framework. Add a reference to &quot;{0}&quot; in the &quot;TargetFrameworks&quot; property of your project file and then re-run NuGet restore..
/// </summary>
- internal static string MissingFrameworkInCsproj {
+ internal static string MissingFrameworkInProjectFile {
get {
- return ResourceManager.GetString("MissingFrameworkInCsproj", resourceCulture);
+ return ResourceManager.GetString("MissingFrameworkInProjectFile", resourceCulture);
}
}
@@ -97,43 +106,43 @@ namespace Microsoft.NuGet.Build.Tasks {
}
/// <summary>
- /// Looks up a localized string similar to Your project is consuming assets from the project &apos;{0}&apos; but no MSBuild project is found in the project lock file. Check the project references in your project csproj file and re-run NuGet restore..
+ /// Looks up a localized string similar to The package &apos;{0}&apos; could not be found in the libraries section of the lock file. This may indicate your lock file is corrupted..
/// </summary>
- internal static string MissingMSBuildPathInProjectPackage {
+ internal static string MissingPackageInTargetsForProjectJson {
get {
- return ResourceManager.GetString("MissingMSBuildPathInProjectPackage", resourceCulture);
+ return ResourceManager.GetString("MissingPackageInTargetsForProjectJson", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to The package &apos;{0}&apos; could not be found in the libraries section of the lock file. This may indicate your lock file is corrupted..
+ /// Looks up a localized string similar to The package &apos;{0}&apos; could not be found in the libraries section of the assets file. This may indicate your assets file is corrupted..
/// </summary>
- internal static string MissingPackageInTargetsSection {
+ internal static string MissingPackageInTargetsSectionForProjectFile {
get {
- return ResourceManager.GetString("MissingPackageInTargetsSection", resourceCulture);
+ return ResourceManager.GetString("MissingPackageInTargetsSectionForProjectFile", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Your project csproj file doesn&apos;t list &apos;{0}&apos; as a targeted runtime. You should add &apos;{1}&apos; to the &quot;RuntimeIdentifiers&quot; property in your project csproj file and then re-run NuGet restore..
+ /// Looks up a localized string similar to Your project file doesn&apos;t list &apos;{0}&apos; as a &quot;RuntimeIdentifier&quot;. You should add &apos;{1}&apos; to the &quot;RuntimeIdentifiers&quot; property in your project file and then re-run NuGet restore..
/// </summary>
- internal static string MissingRuntimeIdentifierInCsproj {
+ internal static string MissingRuntimeIdentifierInProjectFile {
get {
- return ResourceManager.GetString("MissingRuntimeIdentifierInCsproj", resourceCulture);
+ return ResourceManager.GetString("MissingRuntimeIdentifierInProjectFile", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Your project csproj file doesn&apos;t have the &quot;RuntimeIdentifiers&quot; property. You should add &apos;{0}&apos; to your project csproj file and then re-run NuGet restore..
+ /// Looks up a localized string similar to Your project file doesn&apos;t have the &quot;RuntimeIdentifiers&quot; property. You should add &apos;{0}&apos; to your project file and then re-run NuGet restore..
/// </summary>
- internal static string MissingRuntimeIdentifierPropertyInCsproj {
+ internal static string MissingRuntimeIdentifierPropertyInProjectFile {
get {
- return ResourceManager.GetString("MissingRuntimeIdentifierPropertyInCsproj", resourceCulture);
+ return ResourceManager.GetString("MissingRuntimeIdentifierPropertyInProjectFile", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to Your project.json doesn&apos;t list &apos;{0}&apos; as a targeted runtime. You should add &apos;{1}&apos; inside your &quot;runtimes&quot; section in your project.json and then re-run NuGet restore..
+ /// Looks up a localized string similar to Your project.json doesn&apos;t list &apos;{0}&apos; as a &quot;RuntimeIdentifier&quot;. You should add &apos;{1}&apos; inside your &quot;runtimes&quot; section in your project.json and then re-run NuGet restore..
/// </summary>
internal static string MissingRuntimeInProjectJson {
get {
@@ -151,11 +160,11 @@ namespace Microsoft.NuGet.Build.Tasks {
}
/// <summary>
- /// Looks up a localized string similar to No targets could be found in the lock file. Make sure you have &quot;RuntimeIdentifiers&quot; property in your project csproj file..
+ /// Looks up a localized string similar to No targets could be found in the assets file. Make sure you have &quot;RuntimeIdentifiers&quot; property in your project file..
/// </summary>
- internal static string NoTargetsInLockFileForCsproj {
+ internal static string NoTargetsInLockFileForProjectFile {
get {
- return ResourceManager.GetString("NoTargetsInLockFileForCsproj", resourceCulture);
+ return ResourceManager.GetString("NoTargetsInLockFileForProjectFile", resourceCulture);
}
}
diff --git a/src/Microsoft.NuGet.Build.Tasks/Strings.resx b/src/Microsoft.NuGet.Build.Tasks/Strings.resx
index ea0945c..0e26628 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Strings.resx
+++ b/src/Microsoft.NuGet.Build.Tasks/Strings.resx
@@ -122,44 +122,48 @@
<comment>0 token
1 - chosen value</comment>
</data>
- <data name="LockFileNotFound" xml:space="preserve">
+ <data name="LockFileNotFoundForProjectFile" xml:space="preserve">
+ <value>Assets file {0} couldn't be found. Run a NuGet package restore to generate this file.</value>
+ <comment>0 - assets file path</comment>
+ </data>
+ <data name="LockFileNotFoundForProjectJson" xml:space="preserve">
<value>Lock file {0} couldn't be found. Run a NuGet package restore to generate this file.</value>
- <comment>0 - lock file</comment>
+ <comment>0 - lock file path</comment>
</data>
- <data name="MissingFrameworkInCsproj" xml:space="preserve">
- <value>Your project does not reference "{0}" framework. Add a reference to "{0}" in the "TargetFrameworks" property of your project csproj file and then re-run NuGet restore.</value>
+ <data name="MissingFrameworkInProjectFile" xml:space="preserve">
+ <value>Your project does not reference "{0}" framework. Add a reference to "{0}" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.</value>
<comment>0 - target framework</comment>
</data>
<data name="MissingFrameworkInProjectJson" xml:space="preserve">
<value>Your project does not reference "{0}" framework. Add a reference to "{0}" in the "frameworks" section of your project.json and then re-run NuGet restore.</value>
<comment>0 - target framework</comment>
</data>
- <data name="MissingMSBuildPathInProjectPackage" xml:space="preserve">
- <value>Your project is consuming assets from the project '{0}' but no MSBuild project is found in the project lock file. Check the project references in your project csproj file and re-run NuGet restore.</value>
- <comment>0 - project name</comment>
- </data>
- <data name="MissingPackageInTargetsSection" xml:space="preserve">
+ <data name="MissingPackageInTargetsForProjectJson" xml:space="preserve">
<value>The package '{0}' could not be found in the libraries section of the lock file. This may indicate your lock file is corrupted.</value>
<comment>0 package id</comment>
</data>
- <data name="MissingRuntimeIdentifierInCsproj" xml:space="preserve">
- <value>Your project csproj file doesn't list '{0}' as a targeted runtime. You should add '{1}' to the "RuntimeIdentifiers" property in your project csproj file and then re-run NuGet restore.</value>
+ <data name="MissingPackageInTargetsSectionForProjectFile" xml:space="preserve">
+ <value>The package '{0}' could not be found in the libraries section of the assets file. This may indicate your assets file is corrupted.</value>
+ <comment>0 package id</comment>
+ </data>
+ <data name="MissingRuntimeIdentifierInProjectFile" xml:space="preserve">
+ <value>Your project file doesn't list '{0}' as a "RuntimeIdentifier". You should add '{1}' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore.</value>
<comment>0 &amp;1 - Runtime Identifier</comment>
</data>
- <data name="MissingRuntimeIdentifierPropertyInCsproj" xml:space="preserve">
- <value>Your project csproj file doesn't have the "RuntimeIdentifiers" property. You should add '{0}' to your project csproj file and then re-run NuGet restore.</value>
+ <data name="MissingRuntimeIdentifierPropertyInProjectFile" xml:space="preserve">
+ <value>Your project file doesn't have the "RuntimeIdentifiers" property. You should add '{0}' to your project file and then re-run NuGet restore.</value>
<comment>0 - Runtime Identifier</comment>
</data>
<data name="MissingRuntimeInProjectJson" xml:space="preserve">
- <value>Your project.json doesn't list '{0}' as a targeted runtime. You should add '{1}' inside your "runtimes" section in your project.json and then re-run NuGet restore.</value>
+ <value>Your project.json doesn't list '{0}' as a "RuntimeIdentifier". You should add '{1}' inside your "runtimes" section in your project.json and then re-run NuGet restore.</value>
<comment>0 - Runtime Identifier</comment>
</data>
<data name="MissingRuntimesSectionInProjectJson" xml:space="preserve">
<value>Your project.json doesn't have a runtimes section. You should add '{0}' to your project.json and then re-run NuGet restore.</value>
<comment>0 - Runtime Identifier</comment>
</data>
- <data name="NoTargetsInLockFileForCsproj" xml:space="preserve">
- <value>No targets could be found in the lock file. Make sure you have "RuntimeIdentifiers" property in your project csproj file.</value>
+ <data name="NoTargetsInLockFileForProjectFile" xml:space="preserve">
+ <value>No targets could be found in the assets file. Make sure you have "RuntimeIdentifiers" property in your project file.</value>
</data>
<data name="NoTargetsInLockFileForProjectJson" xml:space="preserve">
<value>No targets could be found in the lock file. Make sure you have a supports or runtimes section in your project.json file.</value>