Skip to content

Commit e21e889

Browse files
Little code style nits and msbuild tweaks. (#135)
1 parent 16a97b8 commit e21e889

11 files changed

Lines changed: 19 additions & 24 deletions

RoslynCodeProvider.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29215.179
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.32126.317
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{566A9F52-15C9-4BD0-AD3A-9CC7D391834E}"
77
EndProject

src/DotNetCompilerPlatformTasks/KillProcess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override bool Execute()
2929
if (mo != null)
3030
{
3131
var path = (string)mo["ExecutablePath"];
32-
var executablePath = path != null ? path : string.Empty;
32+
var executablePath = path ?? string.Empty;
3333
Log.LogMessage("ExecutablePath is {0}", executablePath);
3434

3535
if (executablePath.StartsWith(ImagePath, StringComparison.OrdinalIgnoreCase))

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/CSharpCodeProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatform {
1212
/// </summary>
1313
[DesignerCategory("code")]
1414
public sealed class CSharpCodeProvider : Microsoft.CSharp.CSharpCodeProvider {
15-
private IProviderOptions _providerOptions;
15+
private readonly IProviderOptions _providerOptions;
1616

1717
/// <summary>
1818
/// Default Constructor
@@ -35,7 +35,7 @@ public CSharpCodeProvider(ICompilerSettings compilerSettings = null) {
3535
/// </summary>
3636
/// <param name="providerOptions"></param>
3737
public CSharpCodeProvider(IProviderOptions providerOptions = null) {
38-
_providerOptions = providerOptions == null ? CompilationUtil.CSC2 : providerOptions;
38+
_providerOptions = providerOptions ?? CompilationUtil.CSC2;
3939
}
4040

4141
/// <summary>

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),RoslynCodeProvider.sln))\tools\RoslynCodeProvider.settings.targets" />
55
<PropertyGroup>
@@ -15,10 +15,6 @@
1515
<SignAssembly>true</SignAssembly>
1616
<DelaySign>true</DelaySign>
1717
<AssemblyOriginatorKeyFile>$(RepositoryRoot)src\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
18-
<SccProjectName>SAK</SccProjectName>
19-
<SccLocalPath>SAK</SccLocalPath>
20-
<SccAuxPath>SAK</SccAuxPath>
21-
<SccProvider>SAK</SccProvider>
2218
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
2319
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
2420
<RestorePackages>true</RestorePackages>

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Util/CompilationUtil.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,10 @@ public static IProviderOptions GetProviderOptionsFor(string fileExt)
112112
//
113113
// CompilerServerTimeToLive - default 10 seconds in production, 15 minutes in dev environment.
114114
//
115-
int ttl;
116115
string ttlstr = Environment.GetEnvironmentVariable("VBCSCOMPILER_TTL");
117116
if (String.IsNullOrEmpty(ttlstr))
118117
options.TryGetValue("CompilerServerTTL", out ttlstr);
119-
if (!Int32.TryParse(ttlstr, out ttl))
118+
if (!Int32.TryParse(ttlstr, out int ttl))
120119
{
121120
ttl = DefaultCompilerServerTTL;
122121

@@ -131,8 +130,7 @@ public static IProviderOptions GetProviderOptionsFor(string fileExt)
131130
//
132131
// CompilerVersion - if this is null, we don't care.
133132
//
134-
string compilerVersion;
135-
options.TryGetValue("CompilerVersion", out compilerVersion); // Failure to parse sets to null
133+
options.TryGetValue("CompilerVersion", out string compilerVersion); // Failure to parse sets to null
136134

137135
//
138136
// WarnAsError - default false.

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Util/ProviderOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Collections.Generic;
55
using System.Collections.ObjectModel;
6-
using System.Threading;
76

87
namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatform {
98

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/VBCodeProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatform {
1212
/// </summary>
1313
[DesignerCategory("code")]
1414
public sealed class VBCodeProvider : Microsoft.VisualBasic.VBCodeProvider {
15-
private IProviderOptions _providerOptions;
15+
private readonly IProviderOptions _providerOptions;
1616

1717
/// <summary>
1818
/// Default Constructor
@@ -35,7 +35,7 @@ public VBCodeProvider(ICompilerSettings compilerSettings = null) {
3535
/// </summary>
3636
/// <param name="providerOptions"></param>
3737
public VBCodeProvider(IProviderOptions providerOptions = null) {
38-
_providerOptions = providerOptions == null ? CompilationUtil.VBC2 : providerOptions;
38+
_providerOptions = providerOptions ?? CompilationUtil.VBC2;
3939
}
4040

4141
/// <summary>

src/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/VBCompiler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ protected override string CmdArgsFromParameters(CompilerParameters parameters) {
108108
string coreAssemblyFileName = parameters.CoreAssemblyFileName;
109109

110110
if (String.IsNullOrWhiteSpace(parameters.CoreAssemblyFileName)) {
111-
string probableCoreAssemblyFilePath;
112-
if (TryGetProbableCoreAssemblyFilePath(parameters, out probableCoreAssemblyFilePath)) {
111+
if (TryGetProbableCoreAssemblyFilePath(parameters, out string probableCoreAssemblyFilePath))
112+
{
113113
coreAssemblyFileName = probableCoreAssemblyFilePath;
114114
}
115115
}

tools/RoslynCodeProvider.Extensions.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project DefaultTargets="UnitTest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
33
<NupkgToolPath>$(RepositoryRoot)src\Packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform\tools\</NupkgToolPath>
44
<LocalRoslyn46FolderName>Roslyn46</LocalRoslyn46FolderName>

tools/RoslynCodeProvider.settings.targets

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project DefaultTargets="UnitTest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup Label="Project properties">
33
<RepositoryRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'RoslynCodeProvider.sln'))\</RepositoryRoot>
44
</PropertyGroup>
@@ -11,10 +11,12 @@
1111

1212
<PropertyGroup>
1313
<BuildQuality Condition="'$(BuildQuality)' == ''">preview</BuildQuality>
14-
<VersionStartYear>2020</VersionStartYear>
14+
<VersionStartYear>2022</VersionStartYear>
1515
<VersionMajor>3</VersionMajor>
1616
<VersionMinor>11</VersionMinor>
17+
<VersionRevision>0</VersionRevision>
1718
<VersionRelease>0</VersionRelease>
19+
<VersionBuild Condition="'$(VersionBuild)' == '' OR '$(VersionBuild)' == '0'">$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</VersionBuild>
1820
</PropertyGroup>
1921

2022
<PropertyGroup Label="NuGet package dependencies">

0 commit comments

Comments
 (0)