-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental
MSBuild
sdk project (#1864)
- Loading branch information
1 parent
c935954
commit 8e4df46
Showing
9 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<IsPackable>true</IsPackable> | ||
<IsShippingPackage>false</IsShippingPackage> | ||
<PackageId>MSTest.Sdk</PackageId> | ||
<NuspecFile>MSTest.Sdk.nuspec</NuspecFile> | ||
<NuspecBasePath>$(OutputPath)</NuspecBasePath> | ||
<PackageTags>MSTest TestFramework TestAdapter VisualStudio Unittest MSTestV2 Microsoft</PackageTags> | ||
<PackageDescription> | ||
MSTest is Microsoft supported Test Framework. | ||
|
||
This package contains the MSTest MSBuild project SDK. | ||
</PackageDescription> | ||
<!-- Nothing in lib but that's expected --> | ||
<NoWarn>$(NoWarn);NU5128</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="Sdk\**"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Templating" Version="$(MicrosoftDotNetBuildTasksTemplatingPackageVersion)" AllowExplicitReference="true" PrivateAssets="All" IsImplicitlyDefined="true" /> | ||
</ItemGroup> | ||
<Target Name="GenerateTemplates" AfterTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<_TemplateProperties>MSTestVersion=$(MSTestVersion);MicrosoftTestingPlatformVersion=$(MicrosoftTestingPlatformVersion);MicrosoftNETTestSdkVersion=$(MicrosoftNETTestSdkVersion)</_TemplateProperties> | ||
</PropertyGroup> | ||
<!-- List all templates that use ${} template, that will be replaced by the properties defined below. | ||
This will happen on every build. When adding a new file, also add the destination fileto .gitignore. --> | ||
<ItemGroup> | ||
<_TemplateCsproj Include="$(MSBuildProjectDirectory)/Sdk/Sdk.props" Destination="$(MSBuildProjectDirectory)/Sdk/Sdk.props" /> | ||
</ItemGroup> | ||
<GenerateFileFromTemplate TemplateFile="%(_TemplateCsproj.Identity)" OutputPath="%(_TemplateCsproj.Destination)" Properties="$(_TemplateProperties)"> | ||
<Output TaskParameter="ResolvedOutputPath" ItemName="FileWrites" /> | ||
</GenerateFileFromTemplate> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0"?> | ||
<package > | ||
<metadata> | ||
$CommonMetadataElements$ | ||
</metadata> | ||
<files> | ||
$CommonFileElements$ | ||
<file src="netstandard2.0\Sdk\**" target="Sdk" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Project> | ||
<!-- Implicit top import --> | ||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | ||
|
||
<PropertyGroup> | ||
<UseMSTestRunner>true</UseMSTestRunner> | ||
<TestingPlatformDonetTestSupport>false</TestingPlatformDonetTestSupport> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="${MicrosoftNETTestSdkVersion}" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="${MSTestVersion}" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="${MSTestVersion}" /> | ||
<PackageReference Include="Microsoft.Testing.Platform.Extensions.VSTestBridge" Version="${MicrosoftTestingPlatformVersion}" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Target Name="_SetupEntryPoint" BeforeTargets="GenerateProgramFile" Condition=" '$(UseMSTestRunner)' == 'false' " > | ||
<PropertyGroup> | ||
<!-- Disable testing platform entry point generation --> | ||
<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint> | ||
</PropertyGroup> | ||
<!-- | ||
We need to re-enable the VSTest sdk program.* generation by it's by default disabled when we reference Microsoft.Testing.Platform.MSBuild. | ||
We cannot use the GenerateProgramFile property as Microsoft.NET.Test.Sdk.targets it's an 'InitialTargets' and we cannot plug any target before it. | ||
--> | ||
<CallTarget Targets="_GenerateProgramFileTakenFromVSTest" /> | ||
</Target> | ||
|
||
<!-- | ||
============================================================ | ||
GenerateProgramFile taken from Microsoft.NET.Test.Sdk.targets | ||
Generates Program file which contains the Main entry point | ||
============================================================ | ||
--> | ||
<Target Name="_GenerateProgramFileTakenFromVSTest" > | ||
|
||
<ItemGroup Condition="'$(Language)' == 'VB' or '$(Language)' == 'C#'"> | ||
<RemoveExistingMicrosoftNETTestSdkProgram Include="@(Compile)" Condition="'%(FileName)' == 'Microsoft.NET.Test.Sdk.Program'" /> | ||
<Compile Remove="@(RemoveExistingMicrosoftNETTestSdkProgram)" /> | ||
<Compile Include="$(GeneratedProgramFile)"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(Language)' == 'F#'"> | ||
<ProgramCompiles Include="@(Compile)" Condition="'%(Identity)' == 'Program.fs'" /> | ||
<CompileAfter Include="$(GeneratedProgramFile)" Condition="@(ProgramCompiles->Count()) == 0" /> | ||
</ItemGroup> | ||
|
||
<Warning Condition="@(ProgramCompiles->Count()) != 0" Text="A 'Program.fs' file can be automatically generated for F# .NET Core test projects. To fix this warning, either delete the file from the project, or set the <GenerateProgramFile> property to 'false'." /> | ||
|
||
</Target> | ||
|
||
<!-- Implicit bottom import --> | ||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> | ||
</Project> |