Skip to content

Commit

Permalink
Revert "feat: adding -p:RestoreLockedMode=true argument (#206)" (#215)
Browse files Browse the repository at this point in the history
This reverts commit b262389.
  • Loading branch information
dotkas authored Jul 9, 2024
1 parent 287a96c commit 44d8197
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
4 changes: 0 additions & 4 deletions lib/nuget-parser/cli/dotnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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-`),
Expand Down
66 changes: 0 additions & 66 deletions test/cli/dotnet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.*" />
</ItemGroup>
</Project>
`,
},
{
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',
Expand Down

0 comments on commit 44d8197

Please sign in to comment.