Skip to content

Commit

Permalink
Website install shim (#153)
Browse files Browse the repository at this point in the history
* Add installer shim for 'Web Site's. Update nupkg authoring with readme's.

* Ship it.
  • Loading branch information
StephenMolloy authored Jun 14, 2023
1 parent 919235a commit 1b3015a
Show file tree
Hide file tree
Showing 17 changed files with 578 additions and 15 deletions.
6 changes: 1 addition & 5 deletions .nuget/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
</solution>
<packageSources>
<clear />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<packageRestore>
<!-- Disables command-line, automatic, and MSBuild-Integrated restore -->
<add key="enabled" value="True" />
</packageRestore>
</configuration>
Binary file modified .nuget/NuGet.exe
Binary file not shown.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.

## Updates
+ #### Version 4.1.0 (preview1)
- #### :warning: Drop install.ps1, Rely more on msbuild :warning:
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.

<u>**Moving fully to an msbuild/targets-based model will break project-less ASP.Net "Web Sites."**</u> The old install.ps1 way of doing things was becoming less tenable as NuGet continued to evolve. The switch to msbuild/targets was an easy choice. But "Web Site" projects have very limited support in msbuild. We have created a new package that brings back the 'install.ps1' functionality of the 3.X releases _only for WebSites._ It is called [Microsoft.CodeDom.Providers.DotNetCompilerPlatform.WebSites](https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.WebSites).

- #### Refreshed current compilers
In keeping with the new versioning scheme for this project, the version has been revved to 4.1 to match the version of the compilers included.

Expand All @@ -15,9 +20,6 @@ for an introduction to Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
- #### .Net >= 4.7.2
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+.

- #### Drop install.ps1, Rely more on msbuild
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.

+ #### Version 3.11.0 (preview1)
- #### Refreshed compilers
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),RoslynCodeProvider.sln))\tools\RoslynCodeProvider.settings.targets" />
<PropertyGroup>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<NuGetPackageId>$(MSBuildProjectName)</NuGetPackageId>
<NuSpecFile>$(MSBuildProjectName).nuspec</NuSpecFile>
<NuGetPackSymbols>false</NuGetPackSymbols>
<IsPackage>true</IsPackage>
</PropertyGroup>
<ItemGroup>
<NuGetContentProject Include="$(RepositoryRoot)\src\Microsoft.CodeDom.Providers.DotNetCompilerPlatform\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.csproj" />
<NuGetContent Include="Content\web.config.install.xdt">
<Destination>content\net472\web.config.install.xdt</Destination>
</NuGetContent>
<NuGetContent Include="Content\web.config.uninstall.xdt">
<Destination>content\net472\web.config.uninstall.xdt</Destination>
</NuGetContent>
<NuGetContent Include="tools\*.ps1" Condition="'$(SignAssembly)' != 'true'">
<Destination>tools</Destination>
</NuGetContent>
<NuGetContent Include="tools\signed\*.ps1" Condition="'$(SignAssembly)' == 'true'">
<Destination>tools</Destination>
</NuGetContent>
<NuGetContent Include="Readme.md">
<Destination>docs\Readme.md</Destination>
</NuGetContent>
<NuGetContent Include="..\icons\*">
<Destination>icons</Destination>
</NuGetContent>
</ItemGroup>
<Import Project="$(RepositoryRoot)Tools\NuGetProj.targets"/>
<Target Name="SignPowerShellScript" Condition=" '$(SignAssembly)' == 'true' " AfterTargets="BeforeBuild">
<ItemGroup>
<OriginalScriptFiles Include="$(MSBuildThisFileDirectory)\tools\*.ps1" />
</ItemGroup>
<Copy SourceFiles="@(OriginalScriptFiles)" DestinationFolder="$(MSBuildThisFileDirectory)\tools\signed" SkipUnchangedFiles="true" />
<ItemGroup>
<ScriptFilesToSign Include="$(MSBuildThisFileDirectory)\tools\signed\*.ps1">
<Authenticode>Microsoft400</Authenticode>
</ScriptFilesToSign>
</ItemGroup>
<SignFiles Files="@(ScriptFilesToSign)" Type="$(SignType)" BinariesDirectory="$(MSBuildThisFileDirectory)\tools\signed"
IntermediatesDirectory="$(MSBuildThisFileDirectory)\tools" ESRPSigning="$(ESRPSigning)" UseBearerToken="$(UseBearerToken)" />
</Target>
<Target Name="AfterBuild">
<PropertyGroup>
<OutDir>$(PackageOutputDir)</OutDir>
</PropertyGroup>
<ItemGroup>
<FilesToSign Include="$(NuGetPackTargetFile)" Condition="'$(SignAssembly)' == 'true'">
<Authenticode>NuGet</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>$NuGetPackageId$</id>
<title>WebSite Installer for CodeDOM Providers for .NET Compiler Platform ("Roslyn")</title>
<version>$NuGetPackageVersion$</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<copyright>&#169; Microsoft Corporation. All rights reserved.</copyright>
<description>An installer shim to get "Roslyn" CodeDOM providers included in project-less "Web Site" builds.

This package was built from the source at $GitCommitLink$
</description>
<summary>WebSite Shim for CodeDOM providers that use the new .NET Compiler Platform ("Roslyn") compiler as a service APIs.</summary>
<language>en-US</language>
<projectUrl>https://github.com/aspnet/RoslynCodeDomProvider</projectUrl>
<repository type="git" url="https://github.com/aspnet/RoslynCodeDomProvider" commit="$GitCommit$"/>
<icon>icons\dotnet.png</icon>
<readme>docs\Readme.md</readme>
<license type="expression">MIT</license>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<tags>Roslyn CodeDOM Compiler CSharp VB.Net ASP.NET WebSite</tags>

<dependencies>
<dependency id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="[$NuGetPackageVersion$]" />
</dependencies>

</metadata>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Web Site integration for 4.X DotNetCompilerPlatform CodeDom Provider
This is a support package to enable proper integration of the 4.X series of the [Microsoft.CodeDom.Providers.DotNetCompilerPlatform](https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform) package with project-less "Web Sites." This package does not contain any libraries or providers of it's own. It simply restores the old 'install.ps1' nuget functionality to its tightly coupled 'DotNetCompilerPlatform' package dependency. Powershell installation was the only way to integrate with "Web Sites" which have very limited msbuild support.

This package has an exact dependency on the _DotNetCompilerPlatform_ package of the same version.

This package will fail to install on non-"Web Site" projects.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

<!-- If system.codedom tag is absent -->
<system.codedom xdt:Transform="InsertIfMissing">
</system.codedom>

<!-- If compilers tag is absent -->
<system.codedom>
<compilers xdt:Transform="InsertIfMissing" />
</system.codedom>

<!-- If a .cs compiler is already present, the existing entry needs to be removed before inserting the new entry -->
<system.codedom>
<compilers>
<compiler
extension=".cs"
xdt:Transform="Remove"
xdt:Locator="Match(extension)" />
</compilers>
</system.codedom>

<!-- If a .vb compiler is already present, the existing entry needs to be removed before inserting the new entry -->
<system.codedom>
<compilers>
<compiler
extension=".vb"
xdt:Transform="Remove"
xdt:Locator="Match(extension)" />
</compilers>
</system.codedom>

</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="aspnet:RoslynCompilerLocation" value="roslyn" xdt:Transform="Remove" xdt:Locator="Condition(@key='aspnet:RoslynCompilerLocation' and @value='roslyn')" />
</appSettings>
<appSettings xdt:Transform="Remove" xdt:Locator="Condition(count(child::*) = 0)">
</appSettings>
<system.codedom>
<compilers xdt:Transform="Remove" xdt:Locator="Condition(count(child::*) = 0)" />
</system.codedom>
<system.codedom xdt:Transform="Remove" xdt:Locator="Condition(count(child::*) = 0)" />
</configuration>
Loading

0 comments on commit 1b3015a

Please sign in to comment.