Skip to content

Commit 80dd703

Browse files
authored
Dev vsupdate15.3 (#7)
Dev vsupdate15.3
1 parent e92afa1 commit 80dd703

5 files changed

Lines changed: 48 additions & 13 deletions

File tree

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

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Diagnostics;
56
using System.IO;
7+
using System.Runtime.InteropServices;
68

79
namespace Microsoft.CodeDom.Providers.DotNetCompilerPlatform {
810
internal sealed class CompilerSettings : ICompilerSettings {
@@ -34,9 +36,33 @@ int ICompilerSettings.CompilerServerTimeToLive {
3436

3537
internal static class CompilationSettingsHelper {
3638
private const int DefaultCompilerServerTTL = 10; //seconds
39+
private const int DefaultCompilerServerTTLInDevEnvironment = 60 * 15;
40+
private const string DevEnvironmentVariableName = "DEV_ENVIRONMENT";
41+
private const string DebuggerAttachedEnvironmentVariable = "IN_DEBUG_MODE";
3742

38-
private static ICompilerSettings _csc = new CompilerSettings(CompilerFullPath(@"bin\roslyn\csc.exe"), DefaultCompilerServerTTL);
39-
private static ICompilerSettings _vb = new CompilerSettings(CompilerFullPath(@"bin\roslyn\vbc.exe"), DefaultCompilerServerTTL);
43+
private static ICompilerSettings _csc;
44+
private static ICompilerSettings _vb;
45+
46+
static CompilationSettingsHelper() {
47+
var ttl = DefaultCompilerServerTTL;
48+
var devEnvironmentSetting = Environment.GetEnvironmentVariable(DevEnvironmentVariableName, EnvironmentVariableTarget.Process);
49+
var debuggerAttachedEnvironmentSetting = Environment.GetEnvironmentVariable(DebuggerAttachedEnvironmentVariable,
50+
EnvironmentVariableTarget.Process);
51+
var isDebuggerAttached = IsDebuggerAttached;
52+
53+
if (!string.IsNullOrEmpty(devEnvironmentSetting) ||
54+
!string.IsNullOrEmpty(debuggerAttachedEnvironmentSetting) ||
55+
isDebuggerAttached) {
56+
ttl = DefaultCompilerServerTTLInDevEnvironment;
57+
}
58+
59+
_csc = new CompilerSettings(CompilerFullPath(@"bin\roslyn\csc.exe"), ttl);
60+
_vb = new CompilerSettings(CompilerFullPath(@"bin\roslyn\vbc.exe"), ttl);
61+
62+
if (isDebuggerAttached) {
63+
Environment.SetEnvironmentVariable(DebuggerAttachedEnvironmentVariable, "1", EnvironmentVariableTarget.Process);
64+
}
65+
}
4066

4167
public static ICompilerSettings CSC2 {
4268
get {
@@ -54,5 +80,14 @@ private static string CompilerFullPath(string relativePath) {
5480
string compilerFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, relativePath);
5581
return compilerFullPath;
5682
}
83+
84+
private static bool IsDebuggerAttached {
85+
get {
86+
return IsDebuggerPresent() || Debugger.IsAttached;
87+
}
88+
}
89+
90+
[DllImport("kernel32.dll")]
91+
private extern static bool IsDebuggerPresent();
5792
}
5893
}

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/content/net45/web.config.install.xdt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<compiler
2727
language="c#;cs;csharp"
2828
extension=".cs"
29-
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
29+
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
3030
warningLevel="4"
3131
compilerOptions="/langversion:6 /nowarn:1659;1699;1701"
3232
xdt:Transform="Insert" />
@@ -49,7 +49,7 @@
4949
<compiler
5050
language="vb;vbs;visualbasic;vbscript"
5151
extension=".vb"
52-
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
52+
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
5353
warningLevel="4"
5454
compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"
5555
xdt:Transform="Insert" />

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/content/net46/web.config.install.xdt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
<compiler
2727
language="c#;cs;csharp"
2828
extension=".cs"
29-
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
29+
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
3030
warningLevel="4"
31-
compilerOptions="/langversion:7 /nowarn:1659;1699;1701"
31+
compilerOptions="/langversion:default /nowarn:1659;1699;1701"
3232
xdt:Transform="Insert" />
3333
</compilers>
3434
</system.codedom>
@@ -49,9 +49,9 @@
4949
<compiler
5050
language="vb;vbs;visualbasic;vbscript"
5151
extension=".vb"
52-
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
52+
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
5353
warningLevel="4"
54-
compilerOptions="/langversion:15 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"
54+
compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"
5555
xdt:Transform="Insert" />
5656
</compilers>
5757
</system.codedom>

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/tools/install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $binDirectory = Join-Path $projectRoot 'bin'
1818
# Microsoft.VisualStudio.Web.Host.exe cannot find the assembly.
1919
# However, users will see the error after they clean solutions.
2020
New-Item $binDirectory -type directory -force | Out-Null
21-
Copy-Item $libDirectory\* $binDirectory | Out-Null
21+
Copy-Item $libDirectory\* $binDirectory -force | Out-Null
2222

2323
# For Web Site, we need to copy the Roslyn toolset into
2424
# the applicaiton's bin folder.
@@ -56,7 +56,7 @@ if ($project.Type -eq 'Web Site') {
5656
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
5757
$roslynSubDirectory = Join-Path $binDirectory $roslynSubFolder
5858
New-Item $roslynSubDirectory -type directory -force | Out-Null
59-
Copy-Item $compilerPackageToolsDirectory\* $roslynSubDirectory | Out-Null
59+
Copy-Item $compilerPackageToolsDirectory\* $roslynSubDirectory -force | Out-Null
6060

6161
# Generate a .refresh file for each dll/exe file.
6262
Push-Location

tools/RoslynCodeProvider.settings.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<VersionStartYear>2014</VersionStartYear>
77
<VersionMajor>1</VersionMajor>
88
<VersionMinor>0</VersionMinor>
9-
<VersionRelease>4</VersionRelease>
9+
<VersionRelease>5</VersionRelease>
1010
<VersionRelease Condition="'$(BuildQuality)' != 'rtm'">$(VersionRelease)-$(BuildQuality)</VersionRelease>
1111
</PropertyGroup>
1212

1313
<PropertyGroup Label="NuGet package dependencies">
1414
<MSNetCompilersNuGetPackageVersion>1.3.2</MSNetCompilersNuGetPackageVersion>
15-
<MSNetCompilersNuGetPackageLatestVersion>2.0.1</MSNetCompilersNuGetPackageLatestVersion>
15+
<MSNetCompilersNuGetPackageLatestVersion>2.1.0</MSNetCompilersNuGetPackageLatestVersion>
1616
</PropertyGroup>
1717

1818
<!-- Default properties -->

0 commit comments

Comments
 (0)