diff --git a/Directory.Build.targets b/Directory.Build.targets
index 3f272fcf..8a8c891c 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -50,8 +50,8 @@
-
-
+
+
diff --git a/MSBuildSdks.sln b/MSBuildSdks.sln
index ff042d5e..687788b0 100644
--- a/MSBuildSdks.sln
+++ b/MSBuildSdks.sln
@@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DC479DC1
Directory.Build.rsp = Directory.Build.rsp
Directory.Build.targets = Directory.Build.targets
global.json = global.json
- src\GlobalSuppressions.cs = src\GlobalSuppressions.cs
LICENSE.txt = LICENSE.txt
NuGet.config = NuGet.config
Packages.props = Packages.props
diff --git a/Packages.props b/Packages.props
index 9c636d54..d30f3dea 100644
--- a/Packages.props
+++ b/Packages.props
@@ -8,7 +8,7 @@
-
+
@@ -23,7 +23,7 @@
-
-
+
+
diff --git a/src/NoTargets.UnitTests/NoTargetsTests.cs b/src/NoTargets.UnitTests/NoTargetsTests.cs
index 437980ef..2fb3a002 100644
--- a/src/NoTargets.UnitTests/NoTargetsTests.cs
+++ b/src/NoTargets.UnitTests/NoTargetsTests.cs
@@ -93,65 +93,6 @@ public void DoNotReferenceOutputAssemblies()
result.ShouldBeTrue(buildOutput.GetConsoleLog());
}
- [Fact]
- public void EnableDefaultCompileItemsIsFalse()
- {
- ProjectCreator.Templates.NoTargetsProject(
- path: GetTempFileWithExtension(".csproj"))
- .Property("GenerateDependencyFile", "false")
- .Save()
- .TryGetPropertyValue("EnableDefaultCompileItems", out string enableDefaultCompileItems);
-
- enableDefaultCompileItems.ShouldBe("false");
- }
-
- [Fact]
- public void EnableDefaultEmbeddedResourceItemsIsFalse()
- {
- ProjectCreator.Templates.NoTargetsProject(
- path: GetTempFileWithExtension(".csproj"))
- .Property("GenerateDependencyFile", "false")
- .Save()
- .TryGetPropertyValue("EnableDefaultEmbeddedResourceItems", out string enableDefaultEmbeddedResourceItems);
-
- enableDefaultEmbeddedResourceItems.ShouldBe("false");
- }
-
- [Fact]
- public void ImplicitFrameworkReferencesDisabledByDefault()
- {
- ProjectCreator.Templates.NoTargetsProject(
- path: Path.Combine(TestRootPath, "NoTargets", "NoTargets.csproj"),
- targetFramework: "net45")
- .Save()
- .TryGetPropertyValue("DisableImplicitFrameworkReferences", out string disableImplicitFrameworkReferences);
-
- disableImplicitFrameworkReferences.ShouldBe(bool.TrueString, StringCompareShould.IgnoreCase);
- }
-
- [Fact]
- public void IncludeBuildOutputIsFalseByDefault()
- {
- ProjectCreator.Templates.NoTargetsProject(
- path: GetTempFileWithExtension(".csproj"))
- .Save()
- .TryGetPropertyValue("IncludeBuildOutput", out string includeBuildOutput);
-
- includeBuildOutput.ShouldBe("false");
- }
-
- [Fact]
- public void ProduceReferenceAssemblyIsFalse()
- {
- ProjectCreator.Templates.NoTargetsProject(
- path: GetTempFileWithExtension(".csproj"))
- .Property("ProduceReferenceAssembly", "true")
- .Save()
- .TryGetPropertyValue("IncludeBuildOutput", out string produceReferenceAssembly);
-
- produceReferenceAssembly.ShouldBe("false");
- }
-
[Theory]
[InlineData(".csproj")]
[InlineData(".proj")]
@@ -217,6 +158,24 @@ public void ProjectsCanDependOnNoTargetsProjects()
result.ShouldBeTrue(buildOutput.GetConsoleLog());
}
+ [Theory]
+ [InlineData("DisableImplicitFrameworkReferences", "true")]
+ [InlineData("EnableDefaultCompileItems", "false")]
+ [InlineData("EnableDefaultEmbeddedResourceItems", "false")]
+ [InlineData("GenerateAssemblyInfo", "false")]
+ [InlineData("GenerateMSBuildEditorConfigFile", "false")]
+ [InlineData("IncludeBuildOutput", "false")]
+ [InlineData("ProduceReferenceAssembly", "false")]
+ public void PropertiesHaveExpectedValues(string propertyName, string expectedValue)
+ {
+ ProjectCreator.Templates.NoTargetsProject(
+ path: GetTempFileWithExtension(".csproj"))
+ .Save()
+ .TryGetPropertyValue(propertyName, out string actualValue);
+
+ actualValue.ShouldBe(expectedValue, StringComparer.OrdinalIgnoreCase, customMessage: $"Property {propertyName} should have a value of \"{expectedValue}\" but its value was \"{actualValue}\"");
+ }
+
[Theory]
[InlineData(".csproj")]
[InlineData(".proj")]
diff --git a/src/NoTargets/Sdk/Sdk.props b/src/NoTargets/Sdk/Sdk.props
index 0673be70..a6cecde4 100644
--- a/src/NoTargets/Sdk/Sdk.props
+++ b/src/NoTargets/Sdk/Sdk.props
@@ -39,6 +39,12 @@
false
+
+
+ false
+
+
+ false
diff --git a/src/NoTargets/version.json b/src/NoTargets/version.json
index c1c8c09a..9bd59d6f 100644
--- a/src/NoTargets/version.json
+++ b/src/NoTargets/version.json
@@ -1,4 +1,4 @@
{
"inherit": true,
- "version": "3.1"
+ "version": "3.2"
}
diff --git a/src/Shared/MSBuildSdkTestBase.cs b/src/Shared/MSBuildSdkTestBase.cs
index 54ab08b0..3296d2e4 100644
--- a/src/Shared/MSBuildSdkTestBase.cs
+++ b/src/Shared/MSBuildSdkTestBase.cs
@@ -13,27 +13,10 @@ namespace Microsoft.Build.UnitTests.Common
{
public abstract class MSBuildSdkTestBase : MSBuildTestBase, IDisposable
{
- private static readonly string[] EnvironmentVariablesToRemove =
- {
- "MSBuildSdksPath",
- "MSBuildExtensionsPath",
- };
-
- private readonly string _currentDirectoryBackup;
- private readonly Dictionary _environmentVariableBackup = new Dictionary(StringComparer.OrdinalIgnoreCase);
private readonly string _testRootPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
public MSBuildSdkTestBase()
{
- File.WriteAllText(
- Path.Combine(TestRootPath, "global.json"),
- @"{
- ""sdk"": {
- ""version"": ""5.0.100"",
- ""rollForward"": ""latestMinor""
- },
-}");
-
File.WriteAllText(
Path.Combine(TestRootPath, "NuGet.config"),
@"
@@ -44,18 +27,7 @@ public MSBuildSdkTestBase()
");
- // Save the current directory to restore it later
- _currentDirectoryBackup = Environment.CurrentDirectory;
-
Environment.CurrentDirectory = TestRootPath;
-
- // Backup and remove environment variables
- foreach (string environmentVariableName in EnvironmentVariablesToRemove)
- {
- _environmentVariableBackup[environmentVariableName] = Environment.GetEnvironmentVariable(environmentVariableName);
-
- Environment.SetEnvironmentVariable(environmentVariableName, null);
- }
}
public string TestRootPath
@@ -91,24 +63,6 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
- // Restore environment variables
- foreach (var environmentVariable in _environmentVariableBackup)
- {
- Environment.SetEnvironmentVariable(environmentVariable.Key, environmentVariable.Value);
- }
-
- if (Directory.Exists(_currentDirectoryBackup))
- {
- try
- {
- Environment.CurrentDirectory = _currentDirectoryBackup;
- }
- catch (Exception)
- {
- // Ignored
- }
- }
-
if (Directory.Exists(TestRootPath))
{
try