Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2857 from dotnet/brthor/2737
Browse files Browse the repository at this point in the history
fixes #2737
  • Loading branch information
Piotr Puszkiewicz committed May 4, 2016
2 parents 6b9918b + 7cf3603 commit 11a0017
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Microsoft.DotNet.ProjectModel/BuildWorkspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.DotNet.ProjectModel
{
public class BuildWorkspace : Workspace
{
public BuildWorkspace(ProjectReaderSettings settings) : base(settings) { }
public BuildWorkspace(ProjectReaderSettings settings) : base(settings, false) { }

/// <summary>
/// Create an empty <see cref="WorkspaceContext" /> using the default <see cref="ProjectReaderSettings" />
Expand Down Expand Up @@ -58,7 +58,6 @@ public ProjectContext GetRuntimeContext(ProjectContext context, IEnumerable<stri
return CreateBaseProjectBuilder(context.ProjectFile)
.WithTargetFramework(context.TargetFramework)
.WithRuntimeIdentifiers(runtimeIdentifiers)
.AsDesignTime()
.Build();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DotNet.ProjectModel/DesignTimeWorkspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DesignTimeWorkspace : Workspace

private bool _needRefresh;

public DesignTimeWorkspace(ProjectReaderSettings settings) : base(settings) { }
public DesignTimeWorkspace(ProjectReaderSettings settings) : base(settings, true) { }

public void AddProject(string path)
{
Expand Down
6 changes: 4 additions & 2 deletions src/Microsoft.DotNet.ProjectModel/Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ public abstract class Workspace

private readonly ProjectReaderSettings _settings;
private readonly LockFileReader _lockFileReader;
private readonly bool _designTime;

protected Workspace(ProjectReaderSettings settings)
protected Workspace(ProjectReaderSettings settings, bool designTime)
{
_settings = settings;
_lockFileReader = new LockFileReader();
_designTime = designTime;
}

public ProjectContext GetProjectContext(string projectPath, NuGetFramework framework)
Expand Down Expand Up @@ -168,7 +170,7 @@ private FileModelEntry<LockFile> AddLockFileEntry(string projectDirectory, FileM
{
try
{
currentEntry.Model = _lockFileReader.ReadLockFile(currentEntry.FilePath, fs, designTime: true);
currentEntry.Model = _lockFileReader.ReadLockFile(currentEntry.FilePath, fs, designTime: _designTime);
currentEntry.UpdateLastWriteTimeUtc();
}
catch (FileFormatException ex)
Expand Down

0 comments on commit 11a0017

Please sign in to comment.