Skip to content

Commit 49b490e

Browse files
authored
Update C# samples to the latest SDKs (#263)
* Clean up CONTRIBUTING.md * Update the C# samples to Microsoft.Azure.Batch 10.0 * Sample refactoring and improvements - Use OutputFiles where it makes sense. - Use TaskDependencies in TextSearch, as it makes more sense than a JobManager for that case. * Updated supporting assemblies - Microsoft.Azure.Batch.FileStaging and Microsoft.Azure.Batch.Conventions.Files. * Update management sample dependencies
1 parent 938a0fc commit 49b490e

File tree

40 files changed

+280
-507
lines changed

40 files changed

+280
-507
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ If you want to write the output of the build to a file you can tack on ` >> mybu
2323
#### Update the Azure.Batch NuGet project reference
2424
The Azure Batch samples should be kept up to date with the latest Azure.Batch NuGet package.
2525

26-
##### Using nuget.exe
27-
To update the NuGet reference the easiest way is to use the nuget command line:
28-
`for /R %f in (*.sln) do (nuget restore "%f" & nuget update %f -Id Azure.Batch)`
29-
30-
Note that this will miss updating the shared projects, so you'll have to do those by hand (either with the command line or with visual studio). If you do those as well, note that you'll have to fix up the `HintPath` to point to `$(SolutionDirectory)` again.
31-
3226
##### Using a text replace
33-
You can also just do a textual replace. This can be done as long as the dependencies have not changed between the old and new versions of the Azure.Batch NuGet package.
34-
35-
The following commands can be used to perform the textual replace: `rep.exe -find:"<PackageReference Include=\"Microsoft.Azure.Batch\" Version=\"8.1.2\" /> -replace:"<PackageReference Include=\"Microsoft.Azure.Batch\" Version=\"9.0.0\" />" -r *.csproj`
27+
The following commands can be used to perform the textual replace: `rep.exe -find:"<PackageReference Include=\"Microsoft.Azure.Batch\" Version=\"8.1.2\" />" -replace:"<PackageReference Include=\"Microsoft.Azure.Batch\" Version=\"9.0.0\" />" -r *.csproj`
3628

CSharp/AccountManagement/AccountManagement.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="5.1.0" />
15-
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="2.19.208020213" />
16-
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="1.6.0-preview" />
14+
<PackageReference Include="Microsoft.Azure.Management.Batch" Version="7.0.0" />
15+
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="4.4.2" />
16+
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="2.0.0-preview" />
1717
</ItemGroup>
1818

1919
</Project>

CSharp/AccountManagement/Program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ private static async Task MainAsync()
8080
// to query AAD for information that lies outside the application's tenant (such as for
8181
// querying subscription information in your Azure account).
8282
AuthenticationContext authContext = new AuthenticationContext(AuthorityUri);
83-
AuthenticationResult authResult = authContext.AcquireToken(ResourceUri,
84-
ClientId,
85-
new Uri(RedirectUri),
86-
PromptBehavior.Auto);
83+
AuthenticationResult authResult = await authContext.AcquireTokenAsync(
84+
ResourceUri,
85+
ClientId,
86+
new Uri(RedirectUri),
87+
new PlatformParameters(PromptBehavior.Auto));
8788

8889
// The first credential object is used when querying for subscriptions, and is therefore
8990
// not associated with a specific subscription.

CSharp/ArticleProjects/ApplicationInsights/TopNWords/Job.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,11 @@ public async static Task JobMain(string[] args)
9393

9494
files.AddRange(AIFilesToUpload);
9595

96-
var resourceHelperTask = SampleHelpers.UploadResourcesAndCreateResourceFileReferencesAsync(
96+
List<ResourceFile> resourceFiles = await SampleHelpers.UploadResourcesAndCreateResourceFileReferencesAsync(
9797
cloudStorageAccount,
9898
AIBlobContainerName,
9999
files);
100100

101-
List<ResourceFile> resourceFiles = resourceHelperTask.Result;
102-
103101
pool.StartTask = new StartTask()
104102
{
105103
CommandLine = string.Format("cmd /c {0}", BatchStartTaskTelemetryRunnerName),

CSharp/ArticleProjects/ApplicationInsights/TopNWords/TopNWords.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.Azure.Batch" Version="9.0.0" />
18-
<PackageReference Include="Microsoft.Azure.Batch.FileStaging" Version="8.1.0" />
17+
<PackageReference Include="Microsoft.Azure.Batch" Version="10.0.0" />
18+
<PackageReference Include="Microsoft.Azure.Batch.FileStaging" Version="8.2.0" />
1919
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.0" />
2020
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.0" />
2121
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />

CSharp/ArticleProjects/EfficientListQueries/EfficientListQueries.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Batch" Version="9.0.0" />
14+
<PackageReference Include="Microsoft.Azure.Batch" Version="10.0.0" />
1515
</ItemGroup>
1616

1717
</Project>

CSharp/ArticleProjects/JobPrepRelease/JobPrepRelease.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Batch" Version="9.0.0" />
14+
<PackageReference Include="Microsoft.Azure.Batch" Version="10.0.0" />
1515
</ItemGroup>
1616

1717
</Project>

CSharp/ArticleProjects/MultiInstanceTasks/MultiInstanceTasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.Azure.Batch" Version="9.0.0" />
26+
<PackageReference Include="Microsoft.Azure.Batch" Version="10.0.0" />
2727
<PackageReference Include="WindowsAzure.Storage" Version="9.2.0" />
2828
</ItemGroup>
2929

CSharp/ArticleProjects/ParallelTasks/ParallelTasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Batch" Version="9.0.0" />
14+
<PackageReference Include="Microsoft.Azure.Batch" Version="10.0.0" />
1515
</ItemGroup>
1616

1717
</Project>

CSharp/ArticleProjects/PersistOutputs/PersistOutputs.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.Azure.Batch" Version="9.0.0" />
21-
<PackageReference Include="Microsoft.Azure.Batch.Conventions.Files" Version="3.1.0" />
20+
<PackageReference Include="Microsoft.Azure.Batch" Version="10.0.0" />
21+
<PackageReference Include="Microsoft.Azure.Batch.Conventions.Files" Version="3.3.0" />
2222

2323
</ItemGroup>
2424

0 commit comments

Comments
 (0)