Skip to content

Commit 240843b

Browse files
Doc updates 4.5 (#175)
* Add 4.5 updates; improve readability a bit. * Update nupkg Readme
1 parent 0ea3a11 commit 240843b

File tree

2 files changed

+55
-13
lines changed

2 files changed

+55
-13
lines changed

README.md

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,23 @@ Please see the blog [Enabling the .NET Compiler Platform (“Roslyn”) in ASP.N
55
for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
66

77
## Updates
8-
+ #### Version 4.1.0 (preview1)
8+
9+
+ #### Version 4.5.0
10+
- #### Refreshed compilers
11+
In keeping with the new versioning scheme for this project, the version has been revved to 4.5 to match the version of the compilers included.
12+
13+
:information_source: The source of compiler tools in this package has been updated to [Microsoft.Net.Compilers.**Toolset**](https://www.nuget.org/packages/Microsoft.Net.Compilers.Toolset) from the old, deprecated `Microsoft.Net.Compilers` package that had been used before. There shouldn't be any behavioral change due to this change in Roslyn packages.
14+
15+
- #### Fixed targets-based tool copy
16+
The msbuild targets-based identification and copy of Roslyn files to the project output was not working correctly in the last version. This has been fixed to ensure that Roslyn compiler files are copied to the correct location during build.
17+
18+
- #### Still .Net >= 4.7.2
19+
This change was made with the introduction of the 4.X series of this package. But is worth mentioning here, as the call-out of that change is now hidden in the collapsed section below.
20+
21+
<details>
22+
<summary>Older Updates</summary>
23+
24+
+ #### Version 4.1.0
925
- #### :warning: Drop install.ps1, Rely more on msbuild :warning:
1026
Nuget has moved on from install.ps1. We had one foot in the msbuild camp before, and one foot still in the install.ps1 camp. Time to just jump in with both feet. See the 'RoslynRegisterInConfig' setting description below.
1127

@@ -20,7 +36,11 @@ for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
2036
- #### .Net >= 4.7.2
2137
As a result of not keeping older compilers packaged in this project, we can no longer support versions before 4.7.2 because compiler versions 3.0 and newer only support 4.7.2+.
2238

23-
+ #### Version 3.11.0 (preview1)
39+
+ #### Version 3.11.1
40+
- #### Fixed targets-based tool copy
41+
The msbuild targets-based identification and copy of Roslyn files to the project output was not working correctly in the last version. This has been fixed to ensure that Roslyn compiler files are copied to the correct location during build.
42+
43+
+ #### Version 3.11.0
2444
- #### Refreshed compilers
2545
In keeping with the new versioning scheme for this project, the version has been revved to 3.11 to match the version of the compilers included.
2646

@@ -30,6 +50,10 @@ for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
3050
- #### Non-web apps and 'aspnet:RoslynCompilerLocation'
3151
The appSetting `aspnet:RoslynCompilerLocation` can still be used to point at a specific download of the Roslyn compiler tools, but this package is hopefully a little more forgiving when searching for a default location and should accomodate both web projects as well as non-web projects without requiring this setting.
3252

53+
+ #### Version 3.6.1
54+
- #### Fixed targets-based tool copy
55+
The msbuild targets-based identification and copy of Roslyn files to the project output was not working correctly in the last version. This has been fixed to ensure that Roslyn compiler files are copied to the correct location during build.
56+
3357
+ #### Version 3.6.0
3458
- #### Refreshed compilers (and versioning)
3559
This is most likely the update everyone has been looking for. This package contains updated Roslyn bits for newer target frameworks. If your project is targeting 4.7.2 or above, this package will use `Microsoft.Net.Compilers` version 3.5 with your build. You might notice that we have revved our package version to match the most recent compiler version included. For target frameworks 4.6 through 4.7.1, the 2.10 version of compilers is used. (A slight update from 2.9 that shipped with our last package.) And as before, projects targeting 4.5.* will get version 1.3.2 of the compilers. (Note that the language version for 4.6 and above is set to "default", which means C# 7.3 max for full framework projects.)
@@ -55,36 +79,39 @@ for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
5579

5680
- #### What shall I do?
5781
If you are using Visual Studio 2017 with latest update, you should upgrade Microsoft.CodeDom.Providers.DotNetCompilerPlatform nupkg to 2.0.0 and **remove Microsoft.Net.Compilers nupkg from your project**.
58-
82+
</details>
5983

6084
## Configurations
6185
Generally, command-line options for the codedom compilers can be specified using the `compilerOptions` attribute of the compiler when it is registered in configuration. There are however, a handful of options for controlling some behaviors of this package that are not command-line options. These options fall into two broad categories and can be set as follows:
6286

6387
### Build-time Options
64-
+ **(V2) Specify the path to copy Roslyn compiler at build time** - When building projects, target files included by the Microsoft.CodeDom.Providers.DotNetCompilerPlatform nupkg will copy appropriate Roslyn compiler into bin\roslyn folder. With this setting, you can specify a custom path from which the build process will copy the Roslyn compiler, rather than using one of the pre-packaged Roslyn compilers.
88+
+ #### <u>Setting: RoslynToolPath</u>
6589

66-
**Setting name** - RoslynToolPath
90+
**(V2) Specify the path to copy Roslyn compiler at build time** - When building projects, target files included by the Microsoft.CodeDom.Providers.DotNetCompilerPlatform nupkg will copy appropriate Roslyn compiler into bin\roslyn folder. With this setting, you can specify a custom path from which the build process will copy the Roslyn compiler, rather than using one of the pre-packaged Roslyn compilers.
6791

6892
**How to use it** - ```msbuild mysolution.sln /t:build /p:RoslynToolPath="[Roslyn compiler folder full path]"```
6993

7094
**Use case** - In 2.0.0 version, Microsoft.CodeDom.Providers.DotNetCompilerPlatform nupkg removes the dependency on Microsoft.Net.Compilers nupkg. Instead, it embeds one version of Roslyn compiler inside the nupkg. It's possible that the embeded version of Roslyn compiler is not the one you want, so through this setting you can specify a version of Roslyn compiler at build time which will be copied to bin\roslyn folder.
7195

72-
+ **(V4) Skip copying Roslyn compiler at build time** - When building projects, target files will copy the appropriate binaries specified by the 'RoslynToolPath' setting described above and copy them into the project output for runtime use. This copy step can be skipped by using this project setting.
96+
+ #### <u>Setting: RoslynCopyToOutDir</u>
7397

74-
**Setting name** - RoslynCopyToOutDir
98+
**(V4) Skip copying Roslyn compiler at build time** - When building projects, target files will copy the appropriate binaries specified by the 'RoslynToolPath' setting described above and copy them into the project output for runtime use. This copy step can be skipped by using this project setting.
7599

76100
**How to use it** - ```msbuild mysolution.sln /t:build /p:RoslynCopyToOutDir="[true|false]"```
77101

78-
+ **(V4) Don't modify config at build time** - CodeDom providers are not magically picked up from referenced assemblies. They must be explicitly registered in config in order to be used. Prior to the Version 4 update, all modifications to config were performed via powershell scripts included in the nuget package. This powershell method worked with 'packages.config' apps, but does not work with 'PackageReference' apps. As more applications move towards the preferred 'PackageReference' way of doing things, we have updated our method of config registration to be an msbuild task instead of a powershell install script. We take care not to stomp over existing settings. But this step gets checked/performed on every build now instead of just on package install. Use this setting to skip the config update.
102+
+ #### <u>Setting: RoslynRegisterInConfig</u>
79103

80-
**Setting name** - RoslynRegisterInConfig
104+
**(V4) Don't modify config at build time** - CodeDom providers are not magically picked up from referenced assemblies. They must be explicitly registered in config in order to be used. Prior to the Version 4 update, all modifications to config were performed via powershell scripts included in the nuget package. This powershell method worked with 'packages.config' apps, but does not work with 'PackageReference' apps. As more applications move towards the preferred 'PackageReference' way of doing things, we have updated our method of config registration to be an msbuild task instead of a powershell install script. We take care not to stomp over existing settings. But this step gets checked/performed on every build now instead of just on package install. Use this setting to skip the config update.
81105

82106
**How to use it** - ```msbuild mysolution.sln /t:build /p:RoslynRegisterInConfig="[true|false]"```
83107

84108
**Use case** - This config-manipulation step happens on ever build. (Even designer builds.) We take care to be as non-invasive as possible, but if you want us to stay entirely hands-off and update your config registrations manually, this setting enables that.
85109

86110
### Run-time Options
87-
+ **Specify the path to load Roslyn compiler at runtime** - When asp.net compiles the views at runtime or precompile time(using aspnet_compiler to precompile the web app), Microsoft.CodeDom.Providers.DotNetCompilerPlatform needs a path to load Roslyn compiler. This setting can be used to specify this loading path.
111+
112+
+ #### <u>Roslyn Compiler Location</u>
113+
114+
**Specify the path to load Roslyn compiler at runtime** - When asp.net compiles the views at runtime or precompile time(using aspnet_compiler to precompile the web app), Microsoft.CodeDom.Providers.DotNetCompilerPlatform needs a path to load Roslyn compiler. This setting can be used to specify this loading path.
88115

89116
1. **Environment variable** - This is the first setting Microsoft.CodeDom.Providers.DotNetCompilerPlatform reads. If this setting is used, Microsoft.CodeDom.Providers.DotNetCompilerPlatform will ignore the other setting.
90117

@@ -112,7 +139,9 @@ Generally, command-line options for the codedom compilers can be specified using
112139

113140
4. **Default setting** - The default location is bin\roslyn folder.
114141

115-
+ **Specify the TTL of Roslyn compiler server** - Microsoft.CodeDom.Providers.DotNetCompilerPlatform leverages Roslyn compiler server(VBCSCompiler.exe) to compile the generated code. In order to save system resources, VBCSCompiler.exe will be shutdown after idling 10 seconds in the server environment. However, in the development environment(running your web application from visual studio) the idle time is set to 15 mininutes. The reason behind this is to improve the startup performance of your web application when you run/debug the application in Visual Studio, since VBCSCompiler.exe takes several seconds to start if relevant Roslyn assemblies are not NGen'd. With this setting, you can control the idle time of VBCSCompiler.exe.
142+
+ #### <u>Roslyn Server TTL</u>
143+
144+
**Specify the TTL of Roslyn compiler server** - Microsoft.CodeDom.Providers.DotNetCompilerPlatform leverages Roslyn compiler server(VBCSCompiler.exe) to compile the generated code. In order to save system resources, VBCSCompiler.exe will be shutdown after idling 10 seconds in the server environment. However, in the development environment(running your web application from visual studio) the idle time is set to 15 mininutes. The reason behind this is to improve the startup performance of your web application when you run/debug the application in Visual Studio, since VBCSCompiler.exe takes several seconds to start if relevant Roslyn assemblies are not NGen'd. With this setting, you can control the idle time of VBCSCompiler.exe.
116145

117146
1. **Environment variable** - This is the first setting Microsoft.CodeDom.Providers.DotNetCompilerPlatform reads. If this setting is used, Microsoft.CodeDom.Providers.DotNetCompilerPlatform will ignore the other setting.
118147

@@ -128,15 +157,19 @@ Generally, command-line options for the codedom compilers can be specified using
128157

129158
**How to use it** - Add this providerOption into your config file under the `system.codedom/compilers/compiler` to which you want it to apply.
130159

131-
+ **Disable ASP.Net "Magic"** - If the helpful manipulation of `compilerOptions` for running smoothly in an ASP.Net environment is not so helpful for your environment, you can disable this and Microsoft.CodeDom.Providers.DotNetCompilerPlatform will get out of your way, using the `compilerOptions` provided to it with no additions or manipulations.
160+
+ #### <u>ASP.Net "Magic"</u>
161+
162+
**Disable ASP.Net "Magic"** - If the helpful manipulation of `compilerOptions` for running smoothly in an ASP.Net environment is not so helpful for your environment, you can disable this and Microsoft.CodeDom.Providers.DotNetCompilerPlatform will get out of your way, using the `compilerOptions` provided to it with no additions or manipulations.
132163

133164
**Provider Option** - This is the only option to specify whether `compilerOptions` manipulation should happen automatically or not.
134165

135166
**Setting name** - `<providerOption name="UseAspNetSettings" value="[true|false]" />`
136167

137168
**How to use it** - Add this providerOption into your config file under the `system.codedom/compilers/compiler` to which you want it to apply.
138169

139-
+ **Treat Warnings as Errors** - This `System.CodeDom.Compiler.CompilerParameters` property is unfortunately at a conflict with ability to tell the compiler how to behave directly with a `compilerOption`. Prior to v3.5, Microsoft.CodeDom.Providers.DotNetCompilerPlatform would always set this to false. Now developers have a choice in how to manage this conflict.
170+
+ #### <u>Warnings as Errors</u>
171+
172+
**Treat Warnings as Errors** - This `System.CodeDom.Compiler.CompilerParameters` property is unfortunately at a conflict with ability to tell the compiler how to behave directly with a `compilerOption`. Prior to v3.5, Microsoft.CodeDom.Providers.DotNetCompilerPlatform would always set this to false. Now developers have a choice in how to manage this conflict.
140173

141174
**Provider Option** - `<providerOption name="WarnAsError" value="[true|false]" />` - The default is false.
142175

src/Packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/Readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ Please see the blog [Enabling the .NET Compiler Platform (“Roslyn”) in ASP.N
88
for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform. The [project github](https://github.com/aspnet/RoslynCodeDomProvider) also has the most up-to-date documentation of the various settings available for configuring this provider.
99

1010
## Updates
11+
+ #### Version 4.5.0
12+
- #### Refreshed compilers
13+
In keeping with the new versioning scheme for this project, the version has been revved to 4.5 to match the version of the compilers included.
14+
15+
:information_source: The source of compiler tools in this package has been updated to [Microsoft.Net.Compilers.**Toolset**](https://www.nuget.org/packages/Microsoft.Net.Compilers.Toolset) from the old, deprecated `Microsoft.Net.Compilers` package that had been used before. There shouldn't be any behavioral change due to this change in Roslyn packages.
16+
17+
- #### Fixed targets-based tool copy
18+
The msbuild targets-based identification and copy of Roslyn files to the project output was not working correctly in the last version. This has been fixed to ensure that Roslyn compiler files are copied to the correct location during build.
19+
1120
+ #### Version 4.1.0 (preview1)
1221
- #### Drop install.ps1, Rely more on msbuild
1322
Nuget has moved on from install.ps1. We had one foot in the msbuild camp before, and one foot still in the install.ps1 camp. Time to just jump in with both feet. See the 'RoslynRegisterInConfig' setting description below.

0 commit comments

Comments
 (0)