Skip to content

Commit 44d8197

Browse files
authored
Revert "feat: adding -p:RestoreLockedMode=true argument (#206)" (#215)
This reverts commit b262389.
1 parent 287a96c commit 44d8197

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

lib/nuget-parser/cli/dotnet.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ export async function publish(
9494
args.push(targetFramework);
9595
}
9696

97-
// See https://devblogs.microsoft.com/nuget/enable-repeatable-package-restores-using-a-lock-file/
98-
// Forces the usage of the lockfile for PackageReference packages to ensure that the locked versions are published
99-
args.push('-p:RestoreLockedMode=true');
100-
10197
// Define a temporary output dir to use for detecting .dlls to use for runtime version assembly detection.
10298
const tempDir = fs.mkdtempSync(
10399
path.join(os.tmpdir(), `snyk-nuget-plugin-publish-csharp-`),

test/cli/dotnet.spec.ts

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -98,72 +98,6 @@ class TestFixture {
9898
expect(contents).toContain('dotnet_6_and_7.deps.json');
9999
});
100100

101-
it('publishes correctly when a .NET project includes a lockfile', async () => {
102-
const fixtures: types.DotNetFile[] = [
103-
{
104-
name: 'program.cs',
105-
contents: `
106-
using System;
107-
class TestFixture {
108-
static public void Main(String[] args)
109-
{
110-
var client = new System.Net.Http.HttpClient();
111-
Console.WriteLine("Hello, World!");
112-
}
113-
}
114-
`,
115-
},
116-
{
117-
name: 'testproject.csproj',
118-
contents: `
119-
<Project Sdk="Microsoft.NET.Sdk">
120-
121-
<PropertyGroup>
122-
<OutputType>Exe</OutputType>
123-
<TargetFramework>net7.0</TargetFramework>
124-
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
125-
<RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers>
126-
</PropertyGroup>
127-
128-
<ItemGroup>
129-
<PackageReference Include="Newtonsoft.Json" Version="12.*" />
130-
</ItemGroup>
131-
132-
</Project>
133-
`,
134-
},
135-
{
136-
name: 'packages.lock.json',
137-
contents: `
138-
{
139-
"version": 1,
140-
"dependencies": {
141-
"net7.0": {
142-
"Newtonsoft.Json": {
143-
"type": "Direct",
144-
"requested": "[12.*, )",
145-
"resolved": "12.0.3",
146-
"contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg=="
147-
}
148-
},
149-
"net7.0/linux-x64": {},
150-
"net7.0/win-x64": {}
151-
}
152-
}
153-
`,
154-
},
155-
];
156-
projectDirs['publishWithLockfile'] = codeGenerator.generate(
157-
'fixtures',
158-
fixtures,
159-
);
160-
161-
const publishDir = await dotnet.publish(projectDirs['publishWithLockfile']);
162-
163-
const contents = fs.readdirSync(publishDir);
164-
expect(contents).toContain('testproject.deps.json');
165-
});
166-
167101
it.each([
168102
{
169103
shortName: 'net6.0',

0 commit comments

Comments
 (0)