Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Commit

Permalink
Remove redundant references and fixup MSBuild target test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate McMaster committed Jan 6, 2017
1 parent 0e6cf70 commit a91f16e
Show file tree
Hide file tree
Showing 21 changed files with 15 additions and 190 deletions.
14 changes: 0 additions & 14 deletions samples/KeyVaultSample/KeyVaultSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Threading.Tasks">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Threading.Tasks" />
<Reference Include="System.Runtime" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.13.5" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="2.0.6" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,4 @@
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Threading.Thread" Version="4.4.0-*" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,13 @@
</ProjectReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Threading.Tasks">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,4 @@
<PackageReference Include="Microsoft.NETCore.App" Version="1.2.0-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,4 @@
<PackageReference Include="Microsoft.NETCore.App" Version="1.2.0-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Security">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Xml">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@
<PackageReference Include="NETStandard.Library" Version="1.6.2-*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ public void GeneratesAssemblyAttributeFile()
}
var target = Path.Combine(_solutionRoot.FullName, "src", "Microsoft.Extensions.Configuration.UserSecrets", "build", "netstandard1.0", "Microsoft.Extensions.Configuration.UserSecrets.targets");
Directory.CreateDirectory(Path.Combine(_tempDir, "obj"));
var libName = "Microsoft.Extensions.Configuration.UserSecrets.dll";
File.Copy(Path.Combine(AppContext.BaseDirectory, libName), Path.Combine(_tempDir, libName));
File.Copy(target, Path.Combine(_tempDir, "obj", "test.csproj.usersecretstest.targets")); // imitates how NuGet will import this target
var testProj = Path.Combine(_tempDir, "test.csproj");
// should represent a 'dotnet new' project
File.WriteAllText(testProj, @"
File.WriteAllText(testProj, $@"
<Project Sdk=""Microsoft.NET.Sdk"" ToolsVersion=""15.0"">
<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -55,6 +57,7 @@ public void GeneratesAssemblyAttributeFile()
<ItemGroup>
<Compile Include=""Program.cs""/>
<PackageReference Include=""Microsoft.NETCore.App"" Version=""1.0.1"" />
<Reference Include=""$(MSBuildThisFileDirectory){libName}"" />
</ItemGroup>
</Project>
");
Expand Down Expand Up @@ -82,16 +85,18 @@ public void GeneratesAssemblyAttributeFile()
UseShellExecute = false,
WorkingDirectory = _tempDir
};
Process.Start(buildInfo).WaitForExit();
// build will fail because the test proj doesn't reference UserSecrets.dll
// but that's okay. We just want to verify the target generates code correctly
var build = Process.Start(buildInfo);
build.WaitForExit();
Assert.Equal(0, build.ExitCode);

Assert.True(File.Exists(assemblyInfoFile));
var contents = File.ReadAllText(assemblyInfoFile);
Assert.Contains("[assembly: Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute(\"xyz123\")]", contents);
var lastWrite = new FileInfo(assemblyInfoFile).LastWriteTimeUtc;

Process.Start(buildInfo).WaitForExit();
var rebuild = Process.Start(buildInfo);
rebuild.WaitForExit();
Assert.Equal(0, rebuild.ExitCode);
// asserts that the target doesn't re-generate assembly file. Important for incremental build.
Assert.Equal(lastWrite, new FileInfo(assemblyInfoFile).LastWriteTimeUtc);
}
Expand All @@ -100,7 +105,7 @@ public void Dispose()
{
try
{
Directory.Delete(_tempDir, recursive: true);
// Directory.Delete(_tempDir, recursive: true);
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,12 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Runtime">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Collections">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Security">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System.Xml">
<FromP2P>true</FromP2P>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit a91f16e

Please sign in to comment.