Skip to content

Commit

Permalink
Fix net framework (#17)
Browse files Browse the repository at this point in the history
* fixNetFramework

* Update dotnet-desktop.yml

* fixed

* fixed build issue

* deleted

* updated setpackageversions

* exclude Ocaramba.Templates.csproj

* Update dotnet-desktop.yml

* Update dotnet-desktop.yml

* Update dotnet-desktop.yml

* Update dotnet-desktop.yml

* Update dotnet-desktop.yml

* added 	System.Text.Json

* updated

* updated

---------

Co-authored-by: Jakub Raczek <jakub.raczek@accenture.com>
  • Loading branch information
raczeja and jraczek-acc authored Dec 3, 2024
1 parent aa30105 commit d668ba6
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 72 deletions.
142 changes: 75 additions & 67 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,75 @@
on:
workflow_dispatch:
pull_request:
push:
branches:
- '*'
paths-ignore:
- README.md
tags:
- '*'
schedule:
- cron: '0 18 * * 0'
env:
solution: ${{ github.workspace }}/Ocaramba.templates.sln
buildPlatform: Any CPU
buildConfiguration: Release

templateVersion: 2.0.6
OcarambaVersion: 4.2.0

SeleniumWebDriverVersion: 4.4.0
SeleniumSupportVersion: 4.4.0

SeleniumWebdriverChromeDriverVersion: 131.0.6778.8500
SeleniumWebDriverGeckoDriverVersion: 0.35.0
SeleniumWebDriverIEDriverVersion: 4.14.0

NUnitVersion: 3.13.3
NUnit3TestAdapterVersion: 4.6.0

MicrosoftNetTestSdkVersion: 17.12.0
MSTestTestAdapterVersion: 2.2.10
MSTestTestFrameworkVersion: 2.2.10

NPOIVersion: 2.7.2
NLogVersion: 5.3.4
jobs:
build:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v2
- shell: powershell
run: |
$tags = git tag --sort=-creatordate
$tag = $tags[0]
Write-Host "##vso[task.setvariable variable=frameworkVersion]$tag"
if: startsWith(github.ref, 'refs/tags/')
- shell: powershell
run: '((Get-Content -path ./Ocaramba.Templates.VSIX/source.extension.vsixmanifest -Raw) -replace ''Version="\d\.\d.\d" Language'',''Version="${{ env.templateVersion }}" Language'') | Set-Content -Path ./Ocaramba.Templates.VSIX/source.extension.vsixmanifest'
- shell: powershell
run: ./setPackagesVersions.ps1
- name: Set project versions
id: update
uses: vers-one/dotnet-project-version-updater@v1.4
with:
file: |
"**/Ocaramba**.csproj"
version: ${{ env.templateVersion }}
- run: msbuild -t:Restore /p:configuration='${{ env.buildConfiguration }}' /v:minimal
- run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal
- name: 'Ocaramba Templates'
run: gh release upload ${{ env.frameworkVersion }} ./Ocaramba.Templates.VSIX/bin/Release/Ocaramba.Templates.vsix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags/')
on:
workflow_dispatch:
pull_request:
push:
branches:
- '*'
paths-ignore:
- README.md
tags:
- '*'
schedule:
- cron: '0 18 * * 0'
env:
solution: ${{ github.workspace }}/Ocaramba.templates.sln
buildPlatform: Any CPU
buildConfiguration: Release

templateVersion: 2.0.6
OcarambaVersion: 4.2.0

SeleniumWebDriverVersion: 4.27.0
SeleniumSupportVersion: 4.27.0

SeleniumWebdriverChromeDriverVersion: 131.0.6778.8500
SeleniumWebDriverGeckoDriverVersion: 0.35.0
SeleniumWebDriverIEDriverVersion: 4.14.0

NUnitVersion: 4.2.2
NUnit3TestAdapterVersion: 4.6.0

MicrosoftNetTestSdkVersion: 17.12.0
MSTestTestAdapterVersion: 2.2.10
MSTestTestFrameworkVersion: 2.2.10

NPOIVersion: 2.7.2
NLogVersion: 5.3.4

SystemTextJsonVersion: 9.0.0
SystemTextEncodingsWebVersion: 9.0.0
SystemRuntimeCompilerServicesUnsafeVersion: 6.0.0
jobs:
build:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v1
- shell: powershell
run: |
$tags = git tag --sort=-creatordate
$tag = $tags[0]
Write-Host "##vso[task.setvariable variable=frameworkVersion]$tag"
if: startsWith(github.ref, 'refs/tags/')
- shell: powershell
run: '((Get-Content -path ./Ocaramba.Templates.VSIX/source.extension.vsixmanifest -Raw) -replace ''Version="\d\.\d.\d" Language'',''Version="${{ env.templateVersion }}" Language'') | Set-Content -Path ./Ocaramba.Templates.VSIX/source.extension.vsixmanifest'
- shell: powershell
run: ./setPackagesVersions.ps1
- name: Setup nuget
uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- name: Set project versions
id: update
uses: vers-one/dotnet-project-version-updater@v1.4
with:
file: |
"**/Ocaramba**.csproj",
"!**/Ocaramba.Templates.csproj"
version: ${{ env.templateVersion }}
- run: msbuild -t:Restore /p:configuration='${{ env.buildConfiguration }}' /v:minimal
- run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal
- uses: actions/upload-artifact@v4
with:
path: ./Ocaramba.Templates.VSIX/bin/Release/Ocaramba.Templates.vsix
name: Template
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/Ocaramba.ProjectExample.NUnit.NetFramework/Ocaramba.ProjectExample.NUnit.NetFramework.csproj.user
/Ocaramba.ProjectExample.NUnit.NetFramework/NLog.xsd
/Ocaramba.ProjectExample.MsTest.NetFramework/*.user
.vscode/settings.json
22 changes: 19 additions & 3 deletions Ocaramba.ProjectExample.MsTest.NetFramework/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,23 @@
<EdgeChromiumArguments>
<!--<add key="FirefoxArgument" value=""/>-->
</EdgeChromiumArguments>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<startup>
<supportedRuntime version="v4.7.2" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="$SystemTextJson-version$.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="$SystemTextEncodingsWeb-version$.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="$SystemRuntimeCompilerServicesUnsafe-version$.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<CustomParameter Name="$Selenium.WebDriver-version$" Value="4.4.0"/>
<CustomParameter Name="$Selenium.Support-version$" Value="4.4.0"/>
<CustomParameter Name="$MSTest.TestFramework-version$" Value="2.2.10"/>
<CustomParameter Name="$System.Text.Json$" Value="9.0.0" />
<CustomParameter Name="$System.Text.Encodings.Web$" Value="9.0.0" />
<CustomParameter Name="$System.Runtime.CompilerServices.Unsafe$" Value="6.0.0" />
<CustomParameter Name="$NLog-version$" Value="5.0.2"/>
<CustomParameter Name="$Selenium.WebDriver.ChromeDriver-version$" Value="104.0.5112.7900"/>
<CustomParameter Name="$Selenium.WebDriver.GeckoDriver-version$" Value="0.31.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.3.6.3\lib\net462\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.9.0.0\lib\netstandard2.0\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down
2 changes: 2 additions & 0 deletions Ocaramba.ProjectExample.MsTest.NetFramework/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
<package id="Selenium.WebDriver.ChromeDriver" version="$Selenium.WebDriver.ChromeDriver-version$" targetFramework="net472"/>
<package id="Selenium.WebDriver.GeckoDriver" version="$Selenium.WebDriver.GeckoDriver-version$" targetFramework="net472"/>
<package id="Selenium.WebDriver.IEDriver" version="$Selenium.WebDriver.IEDriver-version$" />
<package id="System.Text.Json" version="$System.Text.Json$" />
<package id="System.Runtime.CompilerServices.Unsafe" version="$System.Runtime.CompilerServices.Unsafe$" />
</packages>
22 changes: 20 additions & 2 deletions Ocaramba.ProjectExample.NUnit.NetFramework/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<add key="ImplicitlyWaitMilliseconds" value="200" />
<!--User credentials-->
<add key="username" value="admin" />
<add key="password" value="admin" />
<add key="password" value="admin" />
<!--Downloaded files, screenshots and page source location-->
<add key="UseCurrentDirectory" value="true" />
<add key="DownloadFolder" value="TestOutput" />
Expand Down Expand Up @@ -118,5 +118,23 @@
<EdgeChromiumArguments>
<!--<add key="FirefoxArgument" value=""/>-->
</EdgeChromiumArguments>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
<startup>
<supportedRuntime version="v4.7.2" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="$SystemTextJson-version$.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="$SystemTextEncodingsWeb-version$.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="$SystemRuntimeCompilerServicesUnsafe-version$.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
<CustomParameter Name="$Selenium.WebDriver.ChromeDriver-version$" Value="104.0.5112.7900"/>
<CustomParameter Name="$Selenium.WebDriver.GeckoDriver-version$" Value="0.31.0"/>
<CustomParameter Name="$Selenium.WebDriver.IEDriver-version$" Value="4.3.0"/>
<CustomParameter Name="$SystemTextJson-version$" Value="9.0.0" />
<CustomParameter Name="$SystemTextEncodingsWeb-version$" Value="9.0.0" />
<CustomParameter Name="$SystemRuntimeCompilerServicesUnsafe-version$" Value="6.0.0" />
</CustomParameters>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Text.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.9.0.0\lib\netstandard2.0\System.Text.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
2 changes: 2 additions & 0 deletions Ocaramba.ProjectExample.NUnit.NetFramework/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
<package id="Selenium.WebDriver.ChromeDriver" version="$Selenium.WebDriver.ChromeDriver-version$" targetFramework="net472"/>
<package id="Selenium.WebDriver.GeckoDriver" version="$Selenium.WebDriver.GeckoDriver-version$" targetFramework="net472"/>
<package id="Selenium.WebDriver.IEDriver" version="$Selenium.WebDriver.IEDriver-version$" />
<package id="System.Text.Json" version="$SystemTextJson-version$" />
<package id="System.Runtime.CompilerServices.Unsafe" version="$SystemRuntimeCompilerServicesUnsafe-version$" />
</packages>
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,29 @@ The extension contains:
- Ocaramba NUnit Test Object
- Ocaramba MsTest Test Object


![Add New Project window](images/new-project.png)

![Add New Item window](images/new-item.png)

![Project](images/project.png)

## Troubleshooting & Known Issues
In case of problems with executing tests, update at least TestAdapter and Selenium browser drivers.
You can also try to uninstall and install back one of the browser drivers.

In case of build failure due to a missing package, try uninstalling and reinstalling that package again. In case of problems with unistalling package try to update to previous version and than back update to the latest version.

In case of test execution failure with following error

OneTimeSetUp: System.IO.FileNotFoundException : Could not load fle or assembly 'System.Text.Json, Version=9.0.0.0


Add to your csproj file following lines in ItemGroup section

<Reference Include="System.Text.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.9.0.0\lib\netstandard2.0\System.Text.Json.dll</HintPath>
</Reference>
![Update](images/Update.png)

All templates are located on Visual Studio's **New Project** and **New Item** windows inside **Ocaramba** category.
Expand Down
18 changes: 18 additions & 0 deletions setPackagesVersions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ $MSTestTestFrameworkVersion= $env:MSTestTestFrameworkVersion
$NPOIVersion= $env:NPOIVersion
$NLogVersion= $env:NLogVersion

$SystemTextJsonVersion= $env:SYSTEMTEXTJSONVERSION
$SystemTextEncodingsWebVersion= $env:SYSTEMTEXTENCODINGSWEBVERSION
$SystemRuntimeCompilerServicesUnsafeVersion= $env:SYSTEMRUNTIMECOMPILERSERVICESUNSAFEVERSION

$regex3='(\d+\.\d+\.\d+)'
$regex4='(\d+\.\d+\.\d+\.\d+)'

Expand Down Expand Up @@ -48,6 +52,7 @@ $bArray="Microsoft.NET.Test.Sdk-version`$`" Value=`"$MICROSOFTNETTESTSDKVERSION"
"Selenium.Support-version`$`" Value=`"$SELENIUMSUPPORTVERSION",
"NLog-version`$`" Value=`"$NLOGVERSION"

$cArray="./Ocaramba.ProjectExample.NUnit.NetFramework/App.config","./Ocaramba.ProjectExample.MsTest.NetFramework/App.config"

For ($i=0; $i -lt $aArray.length; $i++) {
echo $bArray[$i]
Expand All @@ -70,4 +75,17 @@ Write-Host $bArray[$i]
((Get-Content -path ./Ocaramba.ProjectExample.NUnit.NetFramework/Ocaramba.NUnit.NF.vstemplate -Raw) -replace $aArray[$i],$bArray[$i]) | Set-Content -Path ./Ocaramba.ProjectExample.NUnit.NetFramework/Ocaramba.NUnit.NF.vstemplate
((Get-Content -path ./Ocaramba.ProjectExample.MsTest.NetFramework/Ocaramba.MsTest.NF.vstemplate -Raw) -replace $aArray[$i],$bArray[$i]) | Set-Content -Path ./Ocaramba.ProjectExample.MsTest.NetFramework/Ocaramba.MsTest.NF.vstemplate
((Get-Content -path ./Ocaramba.ProjectExample.MsTest.NetCore/Ocaramba.MsTest.NC.vstemplate -Raw) -replace $aArray[$i],$bArray[$i]) | Set-Content -Path ./Ocaramba.ProjectExample.MsTest.NetCore/Ocaramba.MsTest.NC.vstemplate
((Get-Content -path ./Ocaramba.ProjectExample.NUnit.NetFramework/App.config -Raw) -replace $aArray[$i],$bArray[$i]) | Set-Content -Path ./Ocaramba.ProjectExample.NUnit.NetFramework/App.config
((Get-Content -path ./Ocaramba.ProjectExample.MsTest.NetFramework/App.config -Raw) -replace $aArray[$i],$bArray[$i]) | Set-Content -Path ./Ocaramba.ProjectExample.MsTest.NetFramework/App.config
}

For ($i=0; $i -lt $cArray.length; $i++) {
echo $cArray[$i]
$configFilePath = $cArray[$i]
$configContent = Get-Content -Path $configFilePath
$configContent = $configContent -replace '\$SystemTextEncodingsWeb-version\$', $SystemTextEncodingsWebVersion
$configContent = $configContent -replace '\$SystemRuntimeCompilerServicesUnsafe-version\$', $SystemRuntimeCompilerServicesUnsafeVersion
$configContent = $configContent -replace '\$SystemTextJson-version\$', $SystemTextJsonVersion

Set-Content -Path $configFilePath -Value $configContent
}

0 comments on commit d668ba6

Please sign in to comment.