Skip to content

Commit 7e74d5c

Browse files
author
maddieclayton
committed
fix path
1 parent d7c0bb7 commit 7e74d5c

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/ResourceManager/Profile/Commands.Profile/AzureRmAlias/Mappings.cs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@ public class Mappings
2323
{
2424
public static Dictionary<string, object> GetCaseInsensitiveMapping()
2525
{
26-
string jsonmapping = GetJsonMapping();
27-
Dictionary<string, object> caseSensitiveMapping = (Dictionary<string, object>)JsonConvert.DeserializeObject(jsonmapping, typeof(Dictionary<string, object>));
28-
var mapping = new Dictionary<string, object>(StringComparer.CurrentCultureIgnoreCase);
29-
foreach (var key in caseSensitiveMapping.Keys)
26+
using (StreamReader r = new StreamReader(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) +
27+
Path.DirectorySeparatorChar + "AzureRmAlias" + Path.DirectorySeparatorChar + "Mappings.json"))
3028
{
31-
mapping.Add(key, caseSensitiveMapping[key]);
32-
}
33-
34-
return mapping;
35-
}
29+
Dictionary<string, object> caseSensitiveMapping = (Dictionary<string, object>)JsonConvert.DeserializeObject(r.ReadToEnd(), typeof(Dictionary<string, object>));
30+
var mapping = new Dictionary<string, object>(StringComparer.CurrentCultureIgnoreCase);
31+
foreach (var key in caseSensitiveMapping.Keys)
32+
{
33+
mapping.Add(key, caseSensitiveMapping[key]);
34+
}
3635

37-
public static string GetJsonMapping()
38-
{
39-
using (StreamReader r = new StreamReader("./Mappings.json"))
40-
{
41-
return r.ReadToEnd();
36+
return mapping;
4237
}
4338
}
4439
}

src/ResourceManager/Profile/Commands.Profile/Commands.Profile.Netcore.csproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
</ItemGroup>
3535

3636
<ItemGroup>
37-
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.9.dll"/>
38-
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.10.dll"/>
37+
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.9.dll" />
38+
<PreLoadAssemblies Include="$(ProjectDir)..\..\..\lib\Newtonsoft.Json.10.dll" />
3939
</ItemGroup>
4040

4141
<ItemGroup>
42-
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.dll"/>
43-
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.DataMovement.dll"/>
42+
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.dll" />
43+
<StorageDependencies Include="$(ProjectDir)..\..\..\lib\Microsoft.WindowsAzure.Storage.DataMovement.dll" />
4444
</ItemGroup>
4545

4646

@@ -60,6 +60,9 @@
6060
</ItemGroup>
6161

6262
<ItemGroup>
63+
<None Update="AzureRmAlias\Mappings.json">
64+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
65+
</None>
6366
<None Update="AzureRmProfileStartup.ps1">
6467
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
6568
</None>
@@ -77,6 +80,7 @@
7780
<Content Include="*.ps1" CopyToOutputDirectory="PreserveNewest" />
7881
<Content Include="*.Netcore.psd1" CopyToOutputDirectory="PreserveNewest" />
7982
<Content Include="*.psm1" CopyToOutputDirectory="PreserveNewest" />
83+
<Content Include="*.json" CopyToOutputDirectory="PreserveNewest" />
8084
</ItemGroup>
8185

8286
<Target Name="CopyFiles" AfterTargets="Build">

0 commit comments

Comments
 (0)