diff --git a/samples/extensions/SampleExtensions.Tests/SampleExtensions.Tests.csproj b/samples/extensions/SampleExtensions.Tests/SampleExtensions.Tests.csproj index c23a2e4c08..1195225dab 100644 --- a/samples/extensions/SampleExtensions.Tests/SampleExtensions.Tests.csproj +++ b/samples/extensions/SampleExtensions.Tests/SampleExtensions.Tests.csproj @@ -14,7 +14,7 @@ - + all diff --git a/src/Microsoft.DotNet.Interactive.CSharpProject/Build/Package.cs b/src/Microsoft.DotNet.Interactive.CSharpProject/Build/Package.cs index fbd20834a9..e7b42a927f 100644 --- a/src/Microsoft.DotNet.Interactive.CSharpProject/Build/Package.cs +++ b/src/Microsoft.DotNet.Interactive.CSharpProject/Build/Package.cs @@ -108,15 +108,7 @@ public Package( public string Name { get; } - private Task EnsureCreatedAsync() - { - if (!EnableBuild) - { - return Task.FromResult(false); - } - - return _lazyCreation.ValueAsync(); - } + private Task EnsureCreatedAsync() => _lazyCreation.ValueAsync(); private bool TryLoadWorkspaceFromCache() { @@ -425,6 +417,11 @@ await File.WriteAllTextAsync( public async Task CreatePackage(IPackageInitializer initializer) { + if (!EnableBuild) + { + throw new InvalidOperationException($"Full build is disabled for package {this}"); + } + using var operation = Log.OnEnterAndConfirmOnExit(); if (!Directory.Exists) @@ -436,12 +433,8 @@ public async Task CreatePackage(IPackageInitializer initializer) using (await FileLock.TryCreateAsync(Directory)) { - if (!Directory.GetFiles("*", SearchOption.AllDirectories).Where(f => !FileLock.IsLockFile(f)).Any()) - { - operation.Info("Initializing package using {_initializer} in {directory}", initializer, - Directory); - await initializer.InitializeAsync(Directory); - } + operation.Info("Initializing package using {_initializer} in {directory}", initializer, Directory); + await initializer.InitializeAsync(Directory); } operation.Succeed(); @@ -454,7 +447,7 @@ public static async Task GetOrCreateConsolePackageAsync(bool enableBuil var packageBuilder = new PackageBuilder("console"); packageBuilder.UseTemplate("console"); packageBuilder.UseLanguageVersion("latest"); - packageBuilder.AddPackageReference("Newtonsoft.Json", "13.0.1"); + packageBuilder.AddPackageReference("Newtonsoft.Json", "13.0.3"); packageBuilder.EnableBuild = enableBuild; var package = packageBuilder.GetPackage(); return package;