Fix sonarcloud call

Use environment variables and property function in .csproj
This commit is contained in:
Michael Ganss
2019-03-31 20:17:01 +02:00
parent 0a9c2df4b9
commit e003e9fa9e
3 changed files with 11 additions and 32 deletions

View File

@@ -9,14 +9,13 @@ environment:
nuget:
disable_publish_on_pr: true
build_script:
- ps: (Get-Content src\HtmlSanitizer\HtmlSanitizer.csproj).Replace("1.0.0-VERSION", $env:APPVEYOR_BUILD_VERSION) | Set-Content src\HtmlSanitizer\HtmlSanitizer.csproj
- dotnet restore
- dotnet pack --include-symbols --include-source -c Release src\HtmlSanitizer
test_script:
- ps: |
if (-not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /k:"mganss_HtmlSanitizer" /v:$env:APPVEYOR_BUILD_VERSION /d:sonar.organization="mganss-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$env:sonar_token" /d:sonar.cs.opencover.reportsPaths="$($env:APPVEYOR_BUILD_FOLDER)\coverage.xml" /d:sonar.coverage.exclusions="**/Program.cs"
dotnet sonarscanner begin /k:"mganss_HtmlSanitizer" /v:$env:APPVEYOR_BUILD_VERSION /o:"mganss-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$env:sonar_token" /d:sonar.cs.opencover.reportsPaths="$($env:APPVEYOR_BUILD_FOLDER)\coverage.xml" /d:sonar.coverage.exclusions="**/Program.cs"
dotnet build
}
- dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput="..\..\coverage.xml" test\HtmlSanitizer.Tests\HtmlSanitizer.Tests.csproj -f netcoreapp2.0

View File

@@ -2,9 +2,12 @@
<PropertyGroup>
<Description>Cleans HTML from constructs that can be used for cross site scripting (XSS)</Description>
<Copyright>Copyright 2013-2018 Michael Ganss</Copyright>
<Copyright>Copyright 2013-$([System.DateTime]::Now.Year) Michael Ganss</Copyright>
<AssemblyTitle>HtmlSanitizer</AssemblyTitle>
<VersionPrefix>1.0.0-VERSION</VersionPrefix>
<AppVeyor_Build_Version Condition="'$(APPVEYOR_BUILD_VERSION)' == ''">1.0.0</AppVeyor_Build_Version>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>$(AppVeyor_Build_Version).0</FileVersion>
<PackageVersion>$(AppVeyor_Build_Version)</PackageVersion>
<Authors>Michael Ganss</Authors>
<TargetFrameworks>net40;net45;netstandard1.3;netstandard2.0;</TargetFrameworks>
<AssemblyName>HtmlSanitizer</AssemblyName>
@@ -14,36 +17,29 @@
<PackageId>HtmlSanitizer</PackageId>
<PackageTags>xss;anti;antixss;html;security</PackageTags>
<PackageProjectUrl>https://github.com/mganss/HtmlSanitizer</PackageProjectUrl>
<PackageLicenseUrl>https://raw.github.com/mganss/HtmlSanitizer/master/LICENSE.md</PackageLicenseUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/mganss/HtmlSanitizer</RepositoryUrl>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.3' ">$(PackageTargetFallback);dotnet</PackageTargetFallback>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<AppConfig Condition="'$(TargetFramework)' == 'net40'">app.net40.config</AppConfig>
<AutoUnifyAssemblyReferences Condition="'$(TargetFramework)' == 'net40'">false</AutoUnifyAssemblyReferences>
<RootNamespace>Ganss.XSS</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\HtmlSanitizer.xml</DocumentationFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AngleSharp" Version="[0.9.11]" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' or '$(TargetFramework)' == 'net45'">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
</ItemGroup>

View File

@@ -1,16 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
#if !NETSTANDARD
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("16af04e9-e712-417e-b749-c8d10148dda9")]
#endif
[assembly: AssemblyVersion("4.0.0.0")]