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 Jain <ankj@microsoft.com>2018-08-03 07:24:04 +0300
committerAnkit Jain <ankj@microsoft.com>2018-08-03 07:24:04 +0300
commit9fe769bdc63d2045e821204c115774dfee1d05e5 (patch)
treee822476fe419369d60edc88eb8a381a73ae55508
parentb2c30bc81b2a7733a4eeb252a55f6b4d50cfc3a1 (diff)
parent640c8e13a9b7ab6e86264a296638fbf3cc016ad1 (diff)
Merge remote-tracking branch 'origin/dev' into dev
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Helpers/TempRoot.cs4
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs20
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx6
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithTargets.assets.json51
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithoutTargets.assets.json39
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/Microsoft.NuGet.Build.Tasks.Tests.csproj20
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/NuGetTestHelpers.cs5
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/ProjectReferences/Resources.Designer.cs2
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs119
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/app.config4
-rw-r--r--src/Microsoft.NuGet.Build.Tasks.Tests/project.json8
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets91
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs77
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs80
-rw-r--r--src/Microsoft.NuGet.Build.Tasks/Strings.resx55
15 files changed, 486 insertions, 95 deletions
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Helpers/TempRoot.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/Helpers/TempRoot.cs
index 7cda580..004171b 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Helpers/TempRoot.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Helpers/TempRoot.cs
@@ -54,9 +54,9 @@ namespace Microsoft.NuGet.Build.Tasks.Tests.Helpers
return dir;
}
- public TempFile CreateFile(TempRoot root, string prefix = null, string extension = null, string directory = null, [CallerFilePath]string callerSourcePath = null, [CallerLineNumber]int callerLineNumber = 0)
+ public TempFile CreateFile(string prefix = null, string extension = null, string directory = null, [CallerFilePath]string callerSourcePath = null, [CallerLineNumber]int callerLineNumber = 0)
{
- return AddFile(new DisposableFile(root, prefix, extension, directory, callerSourcePath, callerLineNumber));
+ return AddFile(new DisposableFile(this, prefix, extension, directory, callerSourcePath, callerLineNumber));
}
public DisposableFile AddFile(DisposableFile file)
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
index e75ea94..9137dec 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs
@@ -358,5 +358,25 @@ namespace Microsoft.NuGet.Build.Tasks.Tests.Json {
return ResourceManager.GetString("Win10_xunit", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Byte[].
+ /// </summary>
+ internal static byte[] WithoutTargets_assets {
+ get {
+ object obj = ResourceManager.GetObject("WithoutTargets_assets", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized resource of type System.Byte[].
+ /// </summary>
+ internal static byte[] WithTargets_assets {
+ get {
+ object obj = ResourceManager.GetObject("WithTargets_assets", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
}
}
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
index 993a1fe..0286e1b 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
@@ -151,4 +151,10 @@
<data name="MultipleProjectFileDependencyGroups_CaseMismatch" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>multipleprojectfiledependencygroups_casemismatch.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
+ <data name="WithoutTargets_assets" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>WithoutTargets.assets.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name="WithTargets_assets" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>WithTargets.assets.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
</root> \ No newline at end of file
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithTargets.assets.json b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithTargets.assets.json
new file mode 100644
index 0000000..bef673f
--- /dev/null
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithTargets.assets.json
@@ -0,0 +1,51 @@
+{
+ "version": 2,
+ "targets": {
+ ".NETFramework,Version=v4.5": {
+ "System.Text/4.5.0": {
+ "type": "package",
+ "dependencies": {
+ "System": "4.5.0"
+ },
+ "compile": {
+ "ref/net45/System.Text.dll": {}
+ }
+ }
+ }
+ },
+ "libraries": {
+ "System.Text/4.5.0": {
+ "type": "package",
+ "path": "system.text/4.5.0"
+ }
+ },
+ "projectFileDependencyGroups": {},
+ "project": {
+ "version": "1.0.0",
+ "restore": {
+ "projectUniqueName": "X:\\ProjectPath\\ProjectPath.csproj",
+ "projectName": "ProjectPath",
+ "projectPath": "X:\\ProjectPath\\ProjectPath.csproj",
+ "outputPath": "X:\\ProjectPath\\obj\\",
+ "projectStyle": "PackageReference",
+ "originalTargetFrameworks": [
+ "net45"
+ ],
+ "frameworks": {
+ "net45": {
+ "projectReferences": {}
+ }
+ }
+ },
+ "frameworks": {
+ "net45": {
+ "dependencies": {
+ "System.Text": {
+ "target": "Package",
+ "version": "[4.5.0, )"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithoutTargets.assets.json b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithoutTargets.assets.json
new file mode 100644
index 0000000..4eae5df
--- /dev/null
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/Json/WithoutTargets.assets.json
@@ -0,0 +1,39 @@
+{
+ "version": 2,
+ "targets": {},
+ "libraries": {
+ "System.Text/4.5.0": {
+ "type": "package",
+ "path": "system.text/4.5.0"
+ }
+ },
+ "projectFileDependencyGroups": {},
+ "project": {
+ "version": "1.0.0",
+ "restore": {
+ "projectUniqueName": "X:\\ProjectPath\\ProjectPath.csproj",
+ "projectName": "ProjectPath",
+ "projectPath": "X:\\ProjectPath\\ProjectPath.csproj",
+ "outputPath": "X:\\ProjectPath\\obj\\",
+ "projectStyle": "PackageReference",
+ "originalTargetFrameworks": [
+ "net45"
+ ],
+ "frameworks": {
+ "net45": {
+ "projectReferences": {}
+ }
+ }
+ },
+ "frameworks": {
+ "net45": {
+ "dependencies": {
+ "System.Text": {
+ "target": "Package",
+ "version": "[4.5.0, )"
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
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 342af76..83774b4 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
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.NuGet.Build.Tasks.Tests</RootNamespace>
<AssemblyName>Microsoft.NuGet.Build.Tasks.Tests</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SignAssembly>true</SignAssembly>
@@ -72,7 +72,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <None Include="app.config" />
+ <None Include="app.config">
+ <SubType>Designer</SubType>
+ </None>
<None Include="Json\analyzers.json" />
<None Include="Json\FluentAssertions.lock.json" />
<None Include="Json\FluentAssertionsAndWin10.lock.json" />
@@ -83,8 +85,9 @@
<None Include="Json\Win10.Edm.json" />
<None Include="Json\Win10.json" />
<None Include="Json\Win10.xunit.json" />
- <None Include="project.json" />
<None Include="Json\ProjectDependency.assets.json" />
+ <None Include="Json\WithoutTargets.assets.json" />
+ <None Include="Json\WithTargets.assets.json" />
<None Include="ProjectReferences\LockFileMissingMSBuildProjectThatProvidesAssets.json" />
<None Include="ProjectReferences\LockFileWithCSProjReference.json" />
</ItemGroup>
@@ -92,6 +95,7 @@
<EmbeddedResource Include="Json\Json.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Json.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="ProjectReferences\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@@ -101,6 +105,16 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
+ <ItemGroup>
+ <PackageReference Include="xunit">
+ <Version>2.3.1</Version>
+ </PackageReference>
+ <PackageReference Include="xunit.runner.visualstudio">
+ <Version>2.3.1</Version>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
+ <PrivateAssets>all</PrivateAssets>
+ </PackageReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/NuGetTestHelpers.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/NuGetTestHelpers.cs
index f31e9d0..3a271d3 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/NuGetTestHelpers.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/NuGetTestHelpers.cs
@@ -7,8 +7,6 @@ using System.IO;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
-using Microsoft.NuGet.Build.Tasks;
-using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Xunit;
using Microsoft.NuGet.Build.Tasks.Tests.Helpers;
@@ -21,6 +19,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
string projectLockJsonFileContents,
string targetMoniker,
string runtimeIdentifier,
+ bool isLockFileProjectJsonBased = true,
string projectLanguage = null,
bool allowFallbackOnTargetSelection = false,
TryGetRuntimeVersion tryGetRuntimeVersion = null,
@@ -33,7 +32,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
{
var projectDirectory = rootDirectory.CreateDirectory();
- var projectLockJsonFile = projectDirectory.CreateFile("project.lock.json");
+ var projectLockJsonFile = projectDirectory.CreateFile(isLockFileProjectJsonBased ? "project.lock.json" : "project.assets.json");
projectLockJsonFile.WriteAllText(projectLockJsonFileContents);
if (projectJsonFileContents != null)
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/ProjectReferences/Resources.Designer.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/ProjectReferences/Resources.Designer.cs
index 1af74df..2d185d8 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/ProjectReferences/Resources.Designer.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/ProjectReferences/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests.ProjectReferences {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs b/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
index 3b690ab..180c94f 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/ReferenceResolutionTests.cs
@@ -4,7 +4,8 @@
using System;
using System.IO;
using System.Linq;
-using Microsoft.NuGet.Build.Tasks;
+using System.Text;
+using Microsoft.NuGet.Build.Tasks.Tests.Helpers;
using Xunit;
namespace Microsoft.NuGet.Build.Tasks.Tests
@@ -88,7 +89,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
runtimeIdentifier: "missing-runtime-identifier",
allowFallbackOnTargetSelection: false));
- Assert.Equal(nameof(Strings.MissingRuntimeInRuntimesSection), exception.ResourceName);
+ Assert.Equal(nameof(Strings.MissingRuntimeInProjectJson), exception.ResourceName);
Assert.Equal(new[] { "missing-runtime-identifier", "\"missing-runtime-identifier\": { }" }, exception.MessageArgs);
}
@@ -103,12 +104,46 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
allowFallbackOnTargetSelection: false,
projectJsonFileContents: "{ }"));
- Assert.Equal(nameof(Strings.MissingRuntimesSection), exception.ResourceName);
+ Assert.Equal(nameof(Strings.MissingRuntimesSectionInProjectJson), exception.ResourceName);
Assert.Equal(new[] { "\"runtimes\": { \"missing-runtime-identifier\": { } }" }, exception.MessageArgs);
}
[Fact]
- public static void TestReferenceResolutionWithMissingTargetMonikerAndNoFallback()
+ public static void TestReferenceResolutionWithMissingRuntimeIDAndNoFallbackInProjectCsproj()
+ {
+ using (var tempRoot = new TempRoot())
+ using (var disposableFile = new DisposableFile(tempRoot.CreateFile(extension: "assets.json").Path))
+ {
+ var exception = Assert.Throws<ExceptionFromResource>(() =>
+ NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
+ Encoding.UTF8.GetString(Json.Json.WithTargets_assets, 0, Json.Json.WithTargets_assets.Length),
+ targetMoniker: ".NETFramework,Version=v4.5",
+ runtimeIdentifier: "missing-runtime-identifier",
+ allowFallbackOnTargetSelection: false,
+ isLockFileProjectJsonBased: false));
+
+ Assert.Equal(nameof(Strings.MissingRuntimeIdentifierInProjectFile), exception.ResourceName);
+ Assert.Equal(new[] { "missing-runtime-identifier", "missing-runtime-identifier" }, exception.MessageArgs);
+ }
+ }
+
+ [Fact]
+ public static void TestReferenceResolutionWithMissingRuntimeIDAndNoFallbackAndNoRuntimesSectionInProjectCsproj()
+ {
+ var exception = Assert.Throws<ExceptionFromResource>(() =>
+ NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
+ Json.Json.Win10,
+ targetMoniker: ".NETCore,Version=v5.0",
+ runtimeIdentifier: "missing-runtime-identifier",
+ allowFallbackOnTargetSelection: false,
+ projectJsonFileContents: "{ }"));
+
+ Assert.Equal(nameof(Strings.MissingRuntimesSectionInProjectJson), exception.ResourceName);
+ Assert.Equal(new[] { "\"runtimes\": { \"missing-runtime-identifier\": { } }" }, exception.MessageArgs);
+ }
+
+ [Fact]
+ public static void TestReferenceResolutionWithMissingTargetFrameworkAndNoFallback()
{
var exception = Assert.Throws<ExceptionFromResource>(() =>
NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
@@ -117,11 +152,30 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
runtimeIdentifier: "missing-runtime-identifier",
allowFallbackOnTargetSelection: false));
- Assert.Equal(nameof(Strings.MissingFramework), exception.ResourceName);
+ Assert.Equal(nameof(Strings.MissingFrameworkInProjectJson), exception.ResourceName);
Assert.Equal(new[] { "Missing,Version=1.0" }, exception.MessageArgs);
}
[Fact]
+ public static void TestReferenceResolutionWithMissingTargetFrameworkAndNoFallbackInProjectCsproj()
+ {
+ using (var tempRoot = new TempRoot())
+ using (var disposableFile = new DisposableFile(tempRoot.CreateFile(extension: "assets.json").Path))
+ {
+ var exception = Assert.Throws<ExceptionFromResource>(() =>
+ NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
+ Encoding.UTF8.GetString(Json.Json.WithoutTargets_assets, 0, Json.Json.WithoutTargets_assets.Length),
+ targetMoniker: "Missing,Version=1.0",
+ runtimeIdentifier: "missing-runtime-identifier",
+ allowFallbackOnTargetSelection: false,
+ isLockFileProjectJsonBased: false));
+
+ Assert.Equal(nameof(Strings.MissingFrameworkInProjectFile), exception.ResourceName);
+ Assert.Equal(new[] { "Missing,Version=1.0" }, exception.MessageArgs);
+ }
+ }
+
+ [Fact]
public static void TestReferenceResolutionWithMissingTargetFrameworkAndFallback()
{
var result = NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
@@ -136,6 +190,45 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
}
[Fact]
+ public static void TestReferenceResolutionWithMissingTargetFrameworkAndFallbackInProjectCsproj()
+ {
+ using (var tempRoot = new TempRoot())
+ using (var disposableFile = new DisposableFile(tempRoot.CreateFile(extension: "assets.json").Path))
+ {
+ var result = NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
+ Encoding.UTF8.GetString(Json.Json.WithTargets_assets, 0, Json.Json.WithTargets_assets.Length),
+ targetMoniker: "MissingFrameworkMoniker,Version=v42.0",
+ runtimeIdentifier: "",
+ allowFallbackOnTargetSelection: true,
+ isLockFileProjectJsonBased: false);
+
+ // We should still have references. Since we have no runtime ID, we should have no copy local items
+ AssertHelpers.AssertCountOf(1, result.References);
+ AssertHelpers.AssertCountOf(0, result.CopyLocalItems);
+ }
+ }
+
+ [Theory]
+ [InlineData(true, nameof(Strings.NoTargetsInLockFileForProjectJson))]
+ [InlineData(false, nameof(Strings.NoTargetsInLockFileForProjectFile))]
+ public static void TestReferenceResolutionWithMissingTargets(bool isProjectJsonBased, string errorResourceName)
+ {
+ using (var tempRoot = new TempRoot())
+ using (var disposableFile = new DisposableFile(tempRoot.CreateFile(extension: "assets.json").Path))
+ {
+ var exception = Assert.Throws<ExceptionFromResource>(() =>
+ NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
+ Encoding.UTF8.GetString(Json.Json.WithoutTargets_assets, 0, Json.Json.WithoutTargets_assets.Length),
+ targetMoniker: "MissingFrameworkMoniker,Version=v42.0",
+ runtimeIdentifier: "",
+ allowFallbackOnTargetSelection: true,
+ isLockFileProjectJsonBased: isProjectJsonBased));
+
+ Assert.Equal(errorResourceName, exception.ResourceName);
+ }
+ }
+
+ [Fact]
public static void TestReferenceResolutionWithNoRuntimeID()
{
var result = NuGetTestHelpers.ResolvePackagesWithJsonFileContents(
@@ -270,9 +363,9 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
var key = ResolveNuGetPackageAssets.NuGetIsFrameworkReference;
var values = result.References.Select(r => r.GetMetadata(key));
-
+
Assert.All(result.References, r => Assert.Contains(key, r.MetadataNames.Cast<string>()));
- Assert.All(values, v => Assert.Contains(v, new [] { "true", "false" }));
+ Assert.All(values, v => Assert.Contains(v, new[] { "true", "false" }));
}
[Fact]
@@ -312,8 +405,8 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
targetMoniker: ".NETCore,Version=v5.0",
runtimeIdentifier: "win10-x86",
tryGetRuntimeVersion: tryGetRuntimeVersion);
-
- var winmd = result.CopyLocalItems.FirstOrDefault(c =>
+
+ var winmd = result.CopyLocalItems.FirstOrDefault(c =>
Path.GetExtension(c.ItemSpec).Equals(".winmd", StringComparison.OrdinalIgnoreCase));
Assert.NotNull(winmd);
@@ -321,7 +414,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
Assert.Equal("true", winmd.GetMetadata("WinMDFile"));
Assert.Equal("Native", winmd.GetMetadata("WinMDFileType"));
Assert.False(string.IsNullOrEmpty(winmd.GetMetadata("Implementation")), "implementation should be set for native winmd");
- Assert.Equal(Path.GetFileNameWithoutExtension(winmd.ItemSpec) + ".dll", winmd.GetMetadata("Implementation"), StringComparer.OrdinalIgnoreCase);
+ Assert.Equal(Path.GetFileNameWithoutExtension(winmd.ItemSpec) + ".dll", winmd.GetMetadata("Implementation"), StringComparer.OrdinalIgnoreCase);
}
[Fact]
@@ -334,8 +427,8 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
targetMoniker: ".NETCore,Version=v5.0",
runtimeIdentifier: "win10-x86",
tryGetRuntimeVersion: tryGetRuntimeVersion);
-
- var winmd = result.CopyLocalItems.FirstOrDefault(c =>
+
+ var winmd = result.CopyLocalItems.FirstOrDefault(c =>
Path.GetExtension(c.ItemSpec).Equals(".winmd", StringComparison.OrdinalIgnoreCase));
Assert.NotNull(winmd);
@@ -356,7 +449,7 @@ namespace Microsoft.NuGet.Build.Tasks.Tests
runtimeIdentifier: "win10-x86",
tryGetRuntimeVersion: tryGetRuntimeVersion);
- var winmd = result.CopyLocalItems.FirstOrDefault(c =>
+ var winmd = result.CopyLocalItems.FirstOrDefault(c =>
Path.GetExtension(c.ItemSpec).Equals(".winmd", StringComparison.OrdinalIgnoreCase));
Assert.NotNull(winmd);
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/app.config b/src/Microsoft.NuGet.Build.Tasks.Tests/app.config
index 845f164..9def342 100644
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/app.config
+++ b/src/Microsoft.NuGet.Build.Tasks.Tests/app.config
@@ -1,6 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="xunit.shadowCopy" value="false"/>
</appSettings>
-</configuration> \ No newline at end of file
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
diff --git a/src/Microsoft.NuGet.Build.Tasks.Tests/project.json b/src/Microsoft.NuGet.Build.Tasks.Tests/project.json
deleted file mode 100644
index f31dee0..0000000
--- a/src/Microsoft.NuGet.Build.Tasks.Tests/project.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "dependencies": {
- "xunit": "2.1.0",
- "xunit.runner.visualstudio": "2.1.0"
- },
- "frameworks": { "net45": { } },
- "runtimes": { "win": { } }
-} \ No newline at end of file
diff --git a/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets b/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets
index e0f7b8b..15ff939 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets
+++ b/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets
@@ -159,7 +159,9 @@ Copyright (c) .NET Foundation. All rights reserved.
============================================================
ResolveNuGetPackageAssets
- Resolve assets from consumed NuGet packages listed in the project.lock.json
+ Resolve assets from consumed NuGet packages listed in the project.lock.json.
+
+ Any changes made here must also be made to ResolveNuGetPackageAssetsNonAOT, below.
[OUT]
@(Analyzer) - Paths to build-time diagnostic analyzers
@@ -231,28 +233,91 @@ Copyright (c) .NET Foundation. All rights reserved.
</CreateItem>
</Target>
- <Target Name="CollectReferencedNuGetPackages" Returns="@(ReferencedNuGetPackages)"/>
+<!--
+ ============================================================
+ ResolveNuGetPackageAssetsNonAOT
- <Target Name="RuntimeImplementationProjectOutputGroup"
- Returns="@(RuntimeImplementationProjectOutputGroupOutput)"
+ Resolve assets from consumed NuGet packages listed in the project.lock.json.
+
+ To support scenarios involving the XAML designer, always uses the non-AOT
+ version of the RuntimeIdentifier.
+
+ Any changes made here must also be made to ResolveNuGetPackageAssets, above.
+
+ [OUT]
+ @(Analyzer) - Paths to build-time diagnostic analyzers
+ @(Reference) - Paths to build-time NuGet dependencies
+ @(ReferenceCopyLocalPaths) - Paths to run-time dependencies to copy
+ ============================================================
+ -->
+
+ <PropertyGroup>
+ <_HandlePackageFileConflictsAfter>$(_HandlePackageFileConflictsAfter);ResolveNuGetPackageAssetsNonAOT</_HandlePackageFileConflictsAfter>
+ </PropertyGroup>
+
+ <Target Name="ResolveNuGetPackageAssetsNonAOT"
+ DependsOnTargets="$(ResolveNuGetPackageAssetsDependsOn)"
Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')">
- <!-- This output group must contain the implementation assemblies for the host (i.e. design time) environment, not the
- target environment. Thus, we explicitly pass the RuntimeIdentifier that doesn't have the -aot suffix -->
<ResolveNuGetPackageAssets AllowFallbackOnTargetSelection="$(DesignTimeBuild)"
+ ContinueOnError="$(ContinueOnError)"
+ IncludeFrameworkReferences="$(IncludeFrameworkReferencesFromNuGet)"
NuGetPackagesDirectory="$(NuGetPackagesDirectory)"
RuntimeIdentifier="$(_NuGetRuntimeIdentifierWithoutAot)"
ProjectLanguage="$(Language)"
ProjectLockFile="$(ProjectLockFile)"
+ ContentPreprocessorValues="@(NuGetPreprocessorValue)"
+ ContentPreprocessorOutputDirectory="$(IntermediateOutputPath)\NuGet"
TargetMonikers="$(NuGetTargetMoniker);$(_NuGetTargetFallbackMoniker)">
- <Output TaskParameter="ResolvedCopyLocalItems" ItemName="NonAheadOfTimeRuntimeImplementations" />
+ <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
+ <Output TaskParameter="ResolvedCopyLocalItems" ItemName="ReferenceCopyLocalPaths" />
+ <Output TaskParameter="ResolvedReferences" ItemName="_ReferencesFromNuGetPackages" />
+ <Output TaskParameter="ReferencedPackages" ItemName="ReferencedNuGetPackages" />
+ <Output TaskParameter="ContentItems" ItemName="_NuGetContentItems" />
+ <Output TaskParameter="FileWrites" ItemName="FileWrites" />
</ResolveNuGetPackageAssets>
<ItemGroup>
- <RuntimeImplementationProjectOutputGroupOutput Include="%(NonAheadOfTimeRuntimeImplementations.Identity)">
- <FinalOutputPath>%(NonAheadOfTimeRuntimeImplementations.FullPath)</FinalOutputPath>
- <TargetPath>%(NonAheadOfTimeRuntimeImplementations.FullPath)</TargetPath>
+ <!-- Remove exact references, such as if a package had a framework reference to 'System' that we already have -->
+ <Reference Remove="@(_ReferencesFromNuGetPackages)" />
+
+ <!-- Remove simple name references that are already implicitly added -->
+ <_ReferencesFromNuGetPackages Remove="%(ReferencePath.FileName)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'" />
+
+ <!-- Include NuGet references in the proper groups. Project-to-project references must go in the
+ _ResolvedProjectReferencePaths group which matches the behavior of the ResolveProjectReferences
+ target. This ensures that even if the assembly is missing on disk, it still makes it to the compiler. -->
+ <Reference Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' != 'Project'" />
+ <_ResolvedProjectReferencePaths Include="@(_ReferencesFromNuGetPackages)" Condition="'%(_ReferencesFromNuGetPackages.NuGetSourceType)' == 'Project'" />
+
+ <!-- Remove simple name references if we're directly providing a reference assembly to the compiler. For example,
+ consider a project with an Reference Include="System", and some NuGet package is providing System.dll -->
+ <Reference Remove="%(_ReferencesFromNuGetPackages.FileName)" Condition="'%(_ReferencesFromNuGetPackages.NuGetIsFrameworkReference)' == 'false'"/>
+ </ItemGroup>
+
+ <PropertyGroup Condition=" '$(AutoUnifyAssemblyReferences)' == 'true' ">
+ <!-- Normally Design Time Assembly Resolution (DTAR) won't consider these references.
+ Put DTAR in a mode where it will prefer the output of RAR and unify. -->
+ <DTARUseReferencesFromProject>true</DTARUseReferencesFromProject>
+ </PropertyGroup>
+
+ <!-- The items in _NuGetContentItems need to go into the appropriately-named item group, but the names depend upon the items
+ themselves. Split it apart. -->
+ <CreateItem Include="@(_NuGetContentItems)" Condition="'@(_NuGetContentItems)' != ''">
+ <Output TaskParameter="Include" ItemName="%(_NuGetContentItems.NuGetItemType)" />
+ </CreateItem>
+ </Target>
+
+ <Target Name="RuntimeImplementationProjectOutputGroup"
+ Returns="@(RuntimeImplementationProjectOutputGroupOutput)"
+ Condition="'$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)')"
+ DependsOnTargets="ResolveNuGetPackageAssetsNonAOT">
+
+ <ItemGroup>
+ <RuntimeImplementationProjectOutputGroupOutput Include="%(ReferenceCopyLocalPaths.Identity)">
+ <FinalOutputPath>%(ReferenceCopyLocalPaths.FullPath)</FinalOutputPath>
+ <TargetPath>%(ReferenceCopyLocalPaths.FullPath)</TargetPath>
</RuntimeImplementationProjectOutputGroupOutput>
</ItemGroup>
</Target>
@@ -264,7 +329,7 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<PropertyGroup>
<NuGetTargetFrameworkMonikerToInject Condition="'$(NuGetTargetFrameworkMonikerToInject)' == ''">.NETCore,Version=v5.0</NuGetTargetFrameworkMonikerToInject>
- <NuGetTargetMonikerToInject Condition="$(DotNetNativeVersion.StartsWith('2.0')) and '$(NuGetTargetMonikerToInject)' == ''">UAP,Version=v10.0.15138</NuGetTargetMonikerToInject>
+ <NuGetTargetMonikerToInject Condition="$(DotNetNativeVersion.StartsWith('2.')) and '$(NuGetTargetMonikerToInject)' == ''">UAP,Version=v10.0.15138</NuGetTargetMonikerToInject>
<NuGetTargetMonikerToInject Condition="'$(NuGetTargetMonikerToInject)' == ''">.NETCore,Version=v5.0</NuGetTargetMonikerToInject>
<_ComputeNetCoreFrameworkInjectionParametersBeforeTargets Condition="'$(AppxPackage)' == 'true' and '$(TargetPlatformIdentifier)' == 'UAP'">BeforeGenerateProjectPriFile</_ComputeNetCoreFrameworkInjectionParametersBeforeTargets>
</PropertyGroup>
@@ -298,14 +363,14 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == '' and $(DotNetNativeVersion.StartsWith('1.7'))">@(_NuGetInjectionSourceDirectories->'%(Identity)\RS2.project.lock.json')</FrameworkInjectionLockFile>
- <FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == '' and $(DotNetNativeVersion.StartsWith('2.0'))">@(_NuGetInjectionSourceDirectories->'%(Identity)\RS3.project.lock.json')</FrameworkInjectionLockFile>
+ <FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == '' and $(DotNetNativeVersion.StartsWith('2.'))">@(_NuGetInjectionSourceDirectories->'%(Identity)\RS3.project.lock.json')</FrameworkInjectionLockFile>
<FrameworkInjectionLockFile Condition="'$(FrameworkInjectionLockFile)' == ''">@(_NuGetInjectionSourceDirectories->'%(Identity)\project.lock.json')</FrameworkInjectionLockFile>
<!-- If the file doesn't exist try to fall back to 5.2.2 file -->
<NuGetTargetMonikerToInject Condition="!Exists('$(FrameworkInjectionLockFile)')">.NETCore,Version=v5.0</NuGetTargetMonikerToInject>
<FrameworkInjectionLockFile Condition="!Exists('$(FrameworkInjectionLockFile)')">@(_NuGetInjectionSourceDirectories->'%(Identity)\project.lock.json')</FrameworkInjectionLockFile>
- <FrameworkInjectionPackagesDirectory Condition="'$(FrameworkInjectionPackagesDirectory)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'NETCoreSDK', null, RegistryView.Registry32, RegistryView.Default))</FrameworkInjectionPackagesDirectory>
+ <FrameworkInjectionPackagesDirectory Condition="'$(FrameworkInjectionPackagesDirectory)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'UWPNugetPackages', null, RegistryView.Registry32, RegistryView.Default))</FrameworkInjectionPackagesDirectory>
</PropertyGroup>
<ResolveNuGetPackageAssets Condition="Exists('$(FrameworkInjectionLockFile)')"
diff --git a/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs b/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
index 97bddf3..7aecc36 100644
--- a/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
+++ b/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
@@ -1,16 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Security.Cryptography;
using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
-using System.Security.Cryptography;
namespace Microsoft.NuGet.Build.Tasks
{
@@ -36,6 +36,8 @@ namespace Microsoft.NuGet.Build.Tasks
internal const string NuGetAssetTypeRuntime = "runtime";
internal const string NuGetAssetTypeResource = "resource";
+ internal const string RuntimeIdentifiersProperty = "RuntimeIdentifiers";
+
private readonly List<ITaskItem> _analyzers = new List<ITaskItem>();
private readonly List<ITaskItem> _copyLocalItems = new List<ITaskItem>();
private readonly List<ITaskItem> _references = new List<ITaskItem>();
@@ -215,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;
@@ -688,7 +694,7 @@ namespace Microsoft.NuGet.Build.Tasks
}
else
{
- ThrowExceptionIfNotAllowingFallback(nameof(Strings.MissingFramework), TargetMonikers.First().ItemSpec);
+ GiveErrorForMissingFramework();
}
// If we're still here, that means we're allowing fallback, so let's try
@@ -707,23 +713,47 @@ namespace Microsoft.NuGet.Build.Tasks
var firstTarget = (JObject)enumerableTargets.FirstOrDefault().Value;
if (firstTarget == null)
{
- throw new ExceptionFromResource(nameof(Strings.NoTargetsInLockFile));
+ GiveErrorForNoTargets();
}
return firstTarget;
}
+ private void GiveErrorForNoTargets()
+ {
+ var noTargetsInLockFileErrorString = IsLockFileProjectJsonBased(ProjectLockFile) ?
+ nameof(Strings.NoTargetsInLockFileForProjectJson) :
+ nameof(Strings.NoTargetsInLockFileForProjectFile);
+
+ throw new ExceptionFromResource(noTargetsInLockFileErrorString);
+ }
+
private void GiveErrorForMissingRuntimeIdentifier()
{
- string runtimePiece = '"' + RuntimeIdentifier + "\": { }";
+ var runtimePiece = RuntimeIdentifier;
+ var runtimesSection = $"<{RuntimeIdentifiersProperty}>{RuntimeIdentifier}</{RuntimeIdentifiersProperty}>";
+ var missingRuntimeInRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierInProjectFile);
+ var missingRuntimesErrorString = nameof(Strings.MissingRuntimeIdentifierPropertyInProjectFile);
- bool hasRuntimesSection;
+ if (IsLockFileProjectJsonBased(ProjectLockFile))
+ {
+ runtimePiece = '"' + RuntimeIdentifier + "\": { }";
+ runtimesSection = "\"runtimes\": { " + runtimePiece + " }";
+ missingRuntimeInRuntimesErrorString = nameof(Strings.MissingRuntimeInProjectJson);
+ missingRuntimesErrorString = nameof(Strings.MissingRuntimesSectionInProjectJson);
+ }
+
+ bool hasRuntimesSection = true;
try
{
- using (var streamReader = new StreamReader(ProjectLockFile.Replace(".lock.json", ".json")))
+ // try reading the project.json file only of the project is project.json based
+ if (IsLockFileProjectJsonBased(ProjectLockFile))
{
- var jsonFile = JObject.Load(new JsonTextReader(streamReader));
- hasRuntimesSection = jsonFile["runtimes"] != null;
+ using (var streamReader = new StreamReader(ProjectLockFile.Replace(".lock.json", ".json")))
+ {
+ var jsonFile = JObject.Load(new JsonTextReader(streamReader));
+ hasRuntimesSection = jsonFile["runtimes"] != null;
+ }
}
}
catch
@@ -734,15 +764,23 @@ namespace Microsoft.NuGet.Build.Tasks
if (hasRuntimesSection)
{
- ThrowExceptionIfNotAllowingFallback(nameof(Strings.MissingRuntimeInRuntimesSection), RuntimeIdentifier, runtimePiece);
+ ThrowExceptionIfNotAllowingFallback(missingRuntimeInRuntimesErrorString, RuntimeIdentifier, runtimePiece);
}
else
{
- var runtimesSection = "\"runtimes\": { " + runtimePiece + " }";
- ThrowExceptionIfNotAllowingFallback(nameof(Strings.MissingRuntimesSection), runtimesSection);
+ ThrowExceptionIfNotAllowingFallback(missingRuntimesErrorString, runtimesSection);
}
}
+ private void GiveErrorForMissingFramework()
+ {
+ var missingFrameworkErrorString = IsLockFileProjectJsonBased(ProjectLockFile) ?
+ nameof(Strings.MissingFrameworkInProjectJson) :
+ nameof(Strings.MissingFrameworkInProjectFile);
+
+ ThrowExceptionIfNotAllowingFallback(missingFrameworkErrorString, TargetMonikers.First().ItemSpec);
+ }
+
private void ThrowExceptionIfNotAllowingFallback(string resourceName, params string[] messageArgs)
{
if (!AllowFallbackOnTargetSelection)
@@ -968,7 +1006,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
@@ -1042,5 +1084,10 @@ namespace Microsoft.NuGet.Build.Tasks
return String.Empty;
}
}
+
+ private static bool IsLockFileProjectJsonBased(string lockFilePath)
+ {
+ return lockFilePath.EndsWith("lock.json", StringComparison.OrdinalIgnoreCase);
+ }
}
}
diff --git a/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs b/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
index 9b3de63..0056db5 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
+++ b/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
@@ -19,7 +19,7 @@ namespace Microsoft.NuGet.Build.Tasks {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
@@ -70,74 +70,110 @@ 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 is not referencing the &quot;{0}&quot; framework. Add a reference to &quot;{0}&quot; in the &quot;frameworks&quot; section of your project.json, 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 MissingFramework {
+ internal static string MissingFrameworkInProjectFile {
get {
- return ResourceManager.GetString("MissingFramework", resourceCulture);
+ return ResourceManager.GetString("MissingFrameworkInProjectFile", resourceCulture);
}
}
/// <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.json. Check the project references in your project file, and 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;frameworks&quot; section of your project.json and then re-run NuGet restore..
/// </summary>
- internal static string MissingMSBuildPathInProjectPackage {
+ internal static string MissingFrameworkInProjectJson {
get {
- return ResourceManager.GetString("MissingMSBuildPathInProjectPackage", resourceCulture);
+ return ResourceManager.GetString("MissingFrameworkInProjectJson", 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..
/// </summary>
- internal static string MissingPackageInTargetsSection {
+ internal static string MissingPackageInTargetsForProjectJson {
+ get {
+ 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 assets file. This may indicate your assets file is corrupted..
+ /// </summary>
+ internal static string MissingPackageInTargetsSectionForProjectFile {
get {
- return ResourceManager.GetString("MissingPackageInTargetsSection", resourceCulture);
+ return ResourceManager.GetString("MissingPackageInTargetsSectionForProjectFile", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to The project.json is referencing the project &apos;{0}&apos;, but an output path was not specified on an item in the {1} property..
+ /// 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 MissingProjectReference {
+ internal static string MissingRuntimeIdentifierInProjectFile {
get {
- return ResourceManager.GetString("MissingProjectReference", resourceCulture);
+ return ResourceManager.GetString("MissingRuntimeIdentifierInProjectFile", 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 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 MissingRuntimeInRuntimesSection {
+ internal static string MissingRuntimeIdentifierPropertyInProjectFile {
get {
- return ResourceManager.GetString("MissingRuntimeInRuntimesSection", 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 &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 {
+ return ResourceManager.GetString("MissingRuntimeInProjectJson", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your project.json doesn&apos;t have a runtimes section. You should add &apos;{0}&apos; to your project.json and then re-run NuGet restore..
/// </summary>
- internal static string MissingRuntimesSection {
+ internal static string MissingRuntimesSectionInProjectJson {
+ get {
+ return ResourceManager.GetString("MissingRuntimesSectionInProjectJson", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// 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 NoTargetsInLockFileForProjectFile {
get {
- return ResourceManager.GetString("MissingRuntimesSection", resourceCulture);
+ return ResourceManager.GetString("NoTargetsInLockFileForProjectFile", resourceCulture);
}
}
/// <summary>
- /// Looks up a localized string similar to No targets could be found in the lock file. Make sure you have a supports or runtimes section i your project.json file..
+ /// Looks up a localized string similar to No targets could be found in the lock file. Make sure you have a supports or runtimes section in your project.json file..
/// </summary>
- internal static string NoTargetsInLockFile {
+ internal static string NoTargetsInLockFileForProjectJson {
get {
- return ResourceManager.GetString("NoTargetsInLockFile", resourceCulture);
+ return ResourceManager.GetString("NoTargetsInLockFileForProjectJson", resourceCulture);
}
}
diff --git a/src/Microsoft.NuGet.Build.Tasks/Strings.resx b/src/Microsoft.NuGet.Build.Tasks/Strings.resx
index 16d5d64..0e26628 100644
--- a/src/Microsoft.NuGet.Build.Tasks/Strings.resx
+++ b/src/Microsoft.NuGet.Build.Tasks/Strings.resx
@@ -119,38 +119,67 @@
</resheader>
<data name="DuplicatePreprocessorToken" xml:space="preserve">
<value>The preprocessor token '{0}' has been given more than one value. Choosing '{1}' as the value.</value>
+ <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 path</comment>
</data>
- <data name="MissingFramework" xml:space="preserve">
- <value>Your project is not referencing the "{0}" framework. Add a reference to "{0}" in the "frameworks" section of your project.json, 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="MissingMSBuildPathInProjectPackage" xml:space="preserve">
- <value>Your project is consuming assets from the project '{0}' but no MSBuild project is found in the project.lock.json. Check the project references in your project file, and re-run NuGet restore.</value>
+ <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="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="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="MissingProjectReference" xml:space="preserve">
- <value>The project.json is referencing the project '{0}', but an output path was not specified on an item in the {1} property.</value>
+ <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="MissingRuntimeInRuntimesSection" 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>
+ <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="MissingRuntimesSection" xml:space="preserve">
+ <data name="MissingRuntimeInProjectJson" xml:space="preserve">
+ <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="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="NoTargetsInLockFile" xml:space="preserve">
- <value>No targets could be found in the lock file. Make sure you have a supports or runtimes section i your project.json file.</value>
+ <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>
</data>
<data name="PackageFolderNotFound" xml:space="preserve">
<value>The package {0} with version {1} could not be found in {2}. Run a NuGet package restore to download the package.</value>
+ <comment>0 - package id
+1 - package version
+2 - package folder path</comment>
</data>
<data name="PreprocessedDirectoryNotSet" xml:space="preserve">
<value>The {0} property must be set in order to consume preprocessed content.</value>
+ <comment>0 - directory path</comment>
</data>
<data name="UnspecifiedToken" xml:space="preserve">
<value>The token '{0}' is unrecognized.</value>
+ <comment>0 - token</comment>
</data>
</root> \ No newline at end of file