From 44d8197f87fa884d275d11c3da6af19b8fc7a087 Mon Sep 17 00:00:00 2001 From: Kaspar Lyngsie Date: Tue, 9 Jul 2024 19:43:52 +0200 Subject: [PATCH] Revert "feat: adding -p:RestoreLockedMode=true argument (#206)" (#215) This reverts commit b262389ab279052989fb42513a45f0b7e4e6fd15. --- lib/nuget-parser/cli/dotnet.ts | 4 --- test/cli/dotnet.spec.ts | 66 ---------------------------------- 2 files changed, 70 deletions(-) diff --git a/lib/nuget-parser/cli/dotnet.ts b/lib/nuget-parser/cli/dotnet.ts index bfc43f8f..8ceaab56 100644 --- a/lib/nuget-parser/cli/dotnet.ts +++ b/lib/nuget-parser/cli/dotnet.ts @@ -94,10 +94,6 @@ export async function publish( args.push(targetFramework); } - // See https://devblogs.microsoft.com/nuget/enable-repeatable-package-restores-using-a-lock-file/ - // Forces the usage of the lockfile for PackageReference packages to ensure that the locked versions are published - args.push('-p:RestoreLockedMode=true'); - // Define a temporary output dir to use for detecting .dlls to use for runtime version assembly detection. const tempDir = fs.mkdtempSync( path.join(os.tmpdir(), `snyk-nuget-plugin-publish-csharp-`), diff --git a/test/cli/dotnet.spec.ts b/test/cli/dotnet.spec.ts index 3303cbfe..885d81f5 100644 --- a/test/cli/dotnet.spec.ts +++ b/test/cli/dotnet.spec.ts @@ -98,72 +98,6 @@ class TestFixture { expect(contents).toContain('dotnet_6_and_7.deps.json'); }); - it('publishes correctly when a .NET project includes a lockfile', async () => { - const fixtures: types.DotNetFile[] = [ - { - name: 'program.cs', - contents: ` -using System; -class TestFixture { - static public void Main(String[] args) - { - var client = new System.Net.Http.HttpClient(); - Console.WriteLine("Hello, World!"); - } -} -`, - }, - { - name: 'testproject.csproj', - contents: ` - - - - Exe - net7.0 - true - linux-x64;win-x64 - - - - - - - - `, - }, - { - name: 'packages.lock.json', - contents: ` - { - "version": 1, - "dependencies": { - "net7.0": { - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[12.*, )", - "resolved": "12.0.3", - "contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg==" - } - }, - "net7.0/linux-x64": {}, - "net7.0/win-x64": {} - } - } -`, - }, - ]; - projectDirs['publishWithLockfile'] = codeGenerator.generate( - 'fixtures', - fixtures, - ); - - const publishDir = await dotnet.publish(projectDirs['publishWithLockfile']); - - const contents = fs.readdirSync(publishDir); - expect(contents).toContain('testproject.deps.json'); - }); - it.each([ { shortName: 'net6.0',