Skip to content

Commit cab407c

Browse files
authored
Merge pull request bdovaz#202 from redwyre/master
Add Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis.Common
2 parents 401555c + fbebe2f commit cab407c

2 files changed

Lines changed: 31 additions & 9 deletions

File tree

registry.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"AsyncKeyedLock": {
1919
"listed": true,
2020
"version": "1.0.0"
21-
},
21+
},
2222
"AutoMapper": {
2323
"listed": true,
2424
"version": "7.0.1"
@@ -468,11 +468,30 @@
468468
"listed": true,
469469
"version": "1.0.0"
470470
},
471+
"Microsoft.CodeAnalysis.Analyzers": {
472+
"listed": true,
473+
"version": "3.0.0",
474+
"analyzer": true
475+
},
471476
"Microsoft.CodeAnalysis.BannedApiAnalyzers": {
472477
"listed": true,
473478
"version": "2.9.0",
474479
"analyzer": true
475480
},
481+
"Microsoft.CodeAnalysis.Common": {
482+
"listed": true,
483+
"version": "3.0.0",
484+
"defineConstraints": [
485+
"UNITY_EDITOR"
486+
]
487+
},
488+
"Microsoft.CodeAnalysis.CSharp": {
489+
"listed": true,
490+
"version": "3.0.0",
491+
"defineConstraints": [
492+
"UNITY_EDITOR"
493+
]
494+
},
476495
"Microsoft.CodeAnalysis.NetAnalyzers": {
477496
"listed": true,
478497
"version": "5.0.3",

src/UnityNuGet/RegistryCache.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,14 @@ RegistryEntry packageEntry
564564

565565
var collectedItems = new Dictionary<FrameworkSpecificGroup, HashSet<RegistryTargetFramework>>();
566566

567-
foreach (var closestVersion in closestVersions)
567+
foreach (var (item, targetFramework) in closestVersions)
568568
{
569-
if (!collectedItems.TryGetValue(closestVersion.Item1, out var frameworksPerGroup))
569+
if (!collectedItems.TryGetValue(item, out var frameworksPerGroup))
570570
{
571571
frameworksPerGroup = new HashSet<RegistryTargetFramework>();
572-
collectedItems.Add(closestVersion.Item1, frameworksPerGroup);
572+
collectedItems.Add(item, frameworksPerGroup);
573573
}
574-
frameworksPerGroup.Add(closestVersion.Item2);
574+
frameworksPerGroup.Add(targetFramework);
575575
}
576576

577577
if (!packageEntry.Analyzer && collectedItems.Count == 0)
@@ -662,14 +662,17 @@ RegistryEntry packageEntry
662662
}
663663
}
664664

665-
foreach (var groupToFrameworks in collectedItems)
665+
foreach (var (item, frameworks) in collectedItems)
666666
{
667-
var item = groupToFrameworks.Key;
668-
var frameworks = groupToFrameworks.Value;
669-
670667
var folderPrefix = hasMultiNetStandard ? $"{frameworks.First().Name}/" : "";
671668
foreach (var file in item.Items)
672669
{
670+
// reject resource dlls since Unity can't use them and we're not handling paths
671+
if (file.EndsWith(".resources.dll", StringComparison.OrdinalIgnoreCase))
672+
{
673+
continue;
674+
}
675+
673676
var fileInUnityPackage = $"{folderPrefix}{Path.GetFileName(file)}";
674677
string? meta;
675678

0 commit comments

Comments
 (0)