Skip to content

Commit

Permalink
Merge pull request dotnet#4859 from davkean/UWP
Browse files Browse the repository at this point in the history
Use NuGetTargetMoniker instead of TFM if its exists
  • Loading branch information
davkean authored May 23, 2019
2 parents c84a7dd + 076a815 commit 7c3e3c9
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ public void ToProjectRestoreInfo_WhenNuGetRestoreRuleMissing_ReturnsEmpty()
Assert.Empty(targetFramework.Properties);
}

[Fact]
public void ToProjectRestoreInfo_RespectsNuGetTargetMonikerIfPresent()
{
var update = IProjectSubscriptionUpdateFactory.FromJson(@"
{
""CurrentState"": {
""NuGetRestore"": {
""Properties"": {
""NuGetTargetMoniker"": ""UWP, Version=v10"",
""TargetFrameworkMoniker"": "".NETFramework, Version=v4.5""
},
}
}
}
");
var result = RestoreBuilder.ToProjectRestoreInfo(update.CurrentState);
var targetFramework = result.TargetFrameworks.Item(0);

Assert.Equal("UWP, Version=v10", targetFramework.TargetFrameworkMoniker);
}

[Fact]
public void ToProjectRestoreInfo_SetsCoreProperties()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ public static IVsProjectRestoreInfo2 ToProjectRestoreInfo(IImmutableDictionary<s
IProjectRuleSnapshot packageReferences = update.GetSnapshotOrEmpty(PackageReference.SchemaName);
IProjectRuleSnapshot toolReferences = update.GetSnapshotOrEmpty(DotNetCliToolReference.SchemaName);

// For certain project types such as UWP, "TargetFrameworkMoniker" != the moniker that restore uses
string targetMoniker = properties.GetPropertyOrEmpty(NuGetRestore.NuGetTargetMonikerProperty);
if (targetMoniker.Length == 0)
targetMoniker = properties.GetPropertyOrEmpty(NuGetRestore.TargetFrameworkMonikerProperty);

IVsTargetFrameworkInfo2 frameworkInfo = new TargetFrameworkInfo(
properties.GetPropertyOrEmpty(NuGetRestore.TargetFrameworkMonikerProperty),
targetMoniker,
ToReferenceItems(frameworkReferences.Items),
ToReferenceItems(packageDownloads.Items),
ToReferenceItems(projectReferences.Items),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,6 @@ In order to debug this project, add an executable project to this solution which
<value>The metadata on 'DotNetCliToolReference' item '{0}' is inconsistent between target frameworks. Only the first one will be restored.</value>
</data>
<data name="Restore_EmptyTargetFrameworkMoniker" xml:space="preserve">
<value>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</value>
<value>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Pokud chcete projekt ladit, přidejte do řešení spustitelný projekt, který
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">Hodnota vlastnosti TargetFrameworkMoniker v konfiguraci {0} je prázdná. Tato konfigurace se nebude podílet na obnovení přes NuGet, což může mít za následek chyby při obnovení a sestavení.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">Hodnota vlastnosti TargetFrameworkMoniker v konfiguraci {0} je prázdná. Tato konfigurace se nebude podílet na obnovení přes NuGet, což může mít za následek chyby při obnovení a sestavení.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Um das Projekt zu debuggen, fügen Sie dieser Projektmappe ein ausführbares Pro
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">Der Wert der Eigenschaft "TargetFrameworkMoniker" in der "{0}"-Konfiguration ist leer. Diese Konfiguration wird bei der NuGet-Wiederherstellung nicht berücksichtigt, was zu Wiederherstellungs- und Buildfehlern führen kann.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">Der Wert der Eigenschaft "TargetFrameworkMoniker" in der "{0}"-Konfiguration ist leer. Diese Konfiguration wird bei der NuGet-Wiederherstellung nicht berücksichtigt, was zu Wiederherstellungs- und Buildfehlern führen kann.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Para depurar este proyecto, agregue un proyecto ejecutable a esta solución con
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">El valor de la propiedad "TargetFrameworkMoniker" en la configuración de "{0}" está vacía. Esta configuración no contribuirá a la restauración de NuGet, lo que puede dar lugar a errores de restauración y compilación.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">El valor de la propiedad "TargetFrameworkMoniker" en la configuración de "{0}" está vacía. Esta configuración no contribuirá a la restauración de NuGet, lo que puede dar lugar a errores de restauración y compilación.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Pour déboguer ce projet, ajoutez à cette solution un projet exécutable qui fa
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">La valeur de la propriété TargetFrameworkMoniker dans la configuration « {0} » est vide. Cette configuration ne contribue pas à la restauration NuGet, ce qui peut entraîner des erreurs de restauration et de build.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">La valeur de la propriété TargetFrameworkMoniker dans la configuration « {0} » est vide. Cette configuration ne contribue pas à la restauration NuGet, ce qui peut entraîner des erreurs de restauration et de build.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Per eseguire il debug del progetto, aggiungere a questa soluzione un progetto es
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">Il valore della proprietà 'TargetFrameworkMoniker' nella configurazione '{0}' è vuoto. Questa configurazione non contribuisce al ripristino di NuGet e questo può comportare errori di ripristino e di compilazione.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">Il valore della proprietà 'TargetFrameworkMoniker' nella configurazione '{0}' è vuoto. Questa configurazione non contribuisce al ripristino di NuGet e questo può comportare errori di ripristino e di compilazione.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ In order to debug this project, add an executable project to this solution which
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">'{0}' 構成の 'TargetFrameworkMoniker' プロパティの値が空です。この構成は NuGet の復元には影響しませんが、復元およびビルドのエラーが発生する可能性があります。</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">'{0}' 構成の 'TargetFrameworkMoniker' プロパティの値が空です。この構成は NuGet の復元には影響しませんが、復元およびビルドのエラーが発生する可能性があります。</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ In order to debug this project, add an executable project to this solution which
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">'{0}' 구성의 'TargetFrameworkMoniker' 속성 값이 비어 있습니다. 이 구성은 NuGet 복원에 기여하지 않아 복원 및 빌드 오류가 발생할 수 있습니다.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">'{0}' 구성의 'TargetFrameworkMoniker' 속성 값이 비어 있습니다. 이 구성은 NuGet 복원에 기여하지 않아 복원 및 빌드 오류가 발생할 수 있습니다.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Aby debugować ten projekt, dodaj projekt wykonywalny do tego rozwiązania, któ
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">Wartość właściwości „TargetFrameworkMoniker” w konfiguracji „{0}” jest pusta. Ta konfiguracja nie przyczyni się do przywracania pakietów NuGet, co może skutkować błędami przywracania i kompilacji.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">Wartość właściwości „TargetFrameworkMoniker” w konfiguracji „{0}” jest pusta. Ta konfiguracja nie przyczyni się do przywracania pakietów NuGet, co może skutkować błędami przywracania i kompilacji.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Para depurar esse projeto, adicione um projeto executável a essa solução que
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">O valor da propriedade 'TargetFrameworkMoniker' na configuração '{0}' está vazio. Essa configuração não contribuirá para a restauração do NuGet, o que pode resultar em erros de restauração e de build.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">O valor da propriedade 'TargetFrameworkMoniker' na configuração '{0}' está vazio. Essa configuração não contribuirá para a restauração do NuGet, o que pode resultar em erros de restauração e de build.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ In order to debug this project, add an executable project to this solution which
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">Значение свойства "TargetFrameworkMoniker" в конфигурации "{0}" является пустым. Эта конфигурация не будет задействована в восстановлении NuGet, что может привести к ошибкам при восстановлении и сборке.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">Значение свойства "TargetFrameworkMoniker" в конфигурации "{0}" является пустым. Эта конфигурация не будет задействована в восстановлении NuGet, что может привести к ошибкам при восстановлении и сборке.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ Bu projede hata ayıklamak için bu çözüme, kitaplık projesine başvuran bir
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">'{0}' yapılandırmasındaki 'TargetFrameworkMoniker' özelliğinin değeri boş. Bu yapılandırma NuGet geri yüklemeye katkıda bulunmaz, bu da geri yükleme ve derleme hatalarına neden olabilir.</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">'{0}' yapılandırmasındaki 'TargetFrameworkMoniker' özelliğinin değeri boş. Bu yapılandırma NuGet geri yüklemeye katkıda bulunmaz, bu da geri yükleme ve derleme hatalarına neden olabilir.</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ In order to debug this project, add an executable project to this solution which
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">“{0}”配置中的 TargetFrameworkMoniker 属性的值为空。此配置将影响 NuGet 还原,这可能导致还原并生成错误。</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">“{0}”配置中的 TargetFrameworkMoniker 属性的值为空。此配置将影响 NuGet 还原,这可能导致还原并生成错误。</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ In order to debug this project, add an executable project to this solution which
<note />
</trans-unit>
<trans-unit id="Restore_EmptyTargetFrameworkMoniker">
<source>The value of the 'TargetFrameworkMoniker' property in the '{0}' configuration is empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="translated">'{0}' 組態中的 'TargetFrameworkMoniker' 屬性值是空的。這樣的組態不會對 NuGet 還原生效,而可能導致還原及建置錯誤。</target>
<source>The value of the 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '{0}' configuration are both empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors.</source>
<target state="needs-review-translation">'{0}' 組態中的 'TargetFrameworkMoniker' 屬性值是空的。這樣的組態不會對 NuGet 還原生效,而可能導致還原及建置錯誤。</target>
<note />
</trans-unit>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@
ReadOnly="True"
Visible="False" />

<StringProperty Name="NuGetTargetMoniker"
ReadOnly="True"
Visible="False" />

<StringProperty Name="TargetFramework"
DisplayName="Target Framework">
<StringProperty.DataSource>
Expand Down

0 comments on commit 7c3e3c9

Please sign in to comment.