forked from MrLuje/Mocking.Helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from rpbeukes/fix-incorrect-code-suggestion
Fix incorrect code suggestions. Related to this [issue](MrLuje#14) Might not be the best fix, but it works for my scenario.
- Loading branch information
Showing
7 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI-master | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: windows-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: get Version from source.extension.vsixmanifest, and append version with run_number | ||
run: | | ||
$manifestPath = '${{ github.workspace }}\Mocking.Helpers\Mocking.Helpers.Vsix\source.extension.vsixmanifest' | ||
$manifestXml = [xml](Get-Content $manifestPath -Raw) | ||
$version = $manifestXml.PackageManifest.Metadata.Identity.Version | ||
$split = $version.Split('.') | ||
$version = $split[0] + '.' + $split[1] + '.' + $split[2] + '.' + ${{ github.run_number }} | ||
echo "APP_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | ||
$manifestXml.PackageManifest.Metadata.Identity.Version = $version | ||
$manifestXml.save($manifestPath) | ||
- name: Print content of source.extension.vsixmanifest | ||
run: get-content .\Mocking.Helpers\Mocking.Helpers.Vsix\source.extension.vsixmanifest | ||
|
||
- name: print APP_VERSION | ||
run: Write-Host $APP_VERSION | ||
|
||
- name: add msbuild to PATH | ||
uses: microsoft/[email protected] | ||
|
||
- name: setup nuget | ||
uses: nuget/setup-nuget@v1 | ||
with: | ||
nuget-version: '6.x' | ||
|
||
- name: nuget restore | ||
run: nuget restore Mocking.Helpers.sln | ||
|
||
- name: build solution | ||
run: msbuild Mocking.Helpers.sln -t:rebuild -property:Configuration=Release | ||
|
||
- name: rename Mocking.Helpers.vsix to Mocking.Helpers.W.X.Y.Z.vsix | ||
run: ren ${{ github.workspace }}\Mocking.Helpers\Mocking.Helpers.vsix\bin\Release\Mocking.Helpers.vsix Mocking.Helpers.${{ env.APP_VERSION }}.vsix | ||
|
||
- name: create artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Mocking.Helpers.${{ env.APP_VERSION }}.vsix | ||
path: ${{ github.workspace }}\Mocking.Helpers\Mocking.Helpers.vsix\bin\Release\Mocking.Helpers.${{ env.APP_VERSION }}.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.CodeAnalysis; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Xml; | ||
|
||
namespace Mocking.Helpers | ||
{ | ||
public static class PackagesHelper | ||
{ | ||
public static IEnumerable<string> GetProjectNugetPackages(Project project) | ||
{ | ||
var csproj = new XmlDocument(); | ||
csproj.Load(project.FilePath); | ||
|
||
var nugetPackages = csproj.SelectNodes("//PackageReference[@Include and @Version]") | ||
.OfType<XmlNode>() | ||
.Select(x => x.Attributes["Include"].Value) | ||
.ToList(); | ||
|
||
return nugetPackages; | ||
} | ||
} | ||
} |