1
0
Форкнуть 0

Added intermediateoutput path to all projects without which 2.0 CLI had issues building. Also aded scripts to run builds and tests.

This commit is contained in:
Cijo Thomas 2017-11-21 13:28:12 -08:00
Родитель ddf6538bee
Коммит cb7b5374fc
17 изменённых файлов: 88 добавлений и 58 удалений

Просмотреть файл

@ -37,35 +37,22 @@ To successfully build the sources on your machine, make sure you've installed th
* .NET 4.6
* .NET Core 2.0
```
git clone https://github.com/Microsoft/ApplicationInsights-aspnetcore.git
```
## Building
From Visual Studio 2017
```
devenv ApplicationInsights.AspNetCore.sln
```
Once you've installed the prerequisites execute ```buildDebug.cmd``` or ```buildRelease.cmd``` script in the repository root to build the project locally.
You can also open the solution in Visual Studio and build the ApplicationInsights.AspNetCore.sln solution directly.
From Visual Studio 2017 Developer Command Prompt: Navigate to the source project folder and use the following commands to build the project:
## Testing/Debugging
Execute the ```runAllTests.cmd``` script in the repository root.
```
dotnet build &REM Builds the project
```
- If you get NPM package restore errors, make sure Node and NPM are added to PATH.
- If you get Bower package restore errors, make sure Git is added to PATH.
- If you get dotnet package restore errors, make sure [.NET Core CLI is installed](https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/cli-installation-scenarios.md) and the nuget feeds are up to date.
You can also open the solution in Visual Studio and run tests directly from Visual Studio Test Explorer. However, as the tests has multiple targets, Test Explorer only shows the first target
from <TargetFrameworks> in .csproj. To debug/run tests from a particular TargetFramework with Visual Studio, only option is to re-arrange the <TargetFrameworks>
such that the intented target comes first. This is a Visual Studio limitation and is likely removed in the future.
## Branches
- We follow the [Git Flow](http://nvie.com/posts/a-successful-git-branching-model) model.
- [master](https://github.com/Microsoft/ApplicationInsights-aspnetcore/tree/master) has the _latest_ version released on [NuGet.org](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore).
- [develop](https://github.com/Microsoft/ApplicationInsights-aspnetcore/tree/develop) has the code for the _next_ release.
Running and writing tests
-------------------------
There are two sets of tests unit tests and functional tests. Please use unit tests for all features testing. The purpose of functional tests is just end-to-end validation of functionality on sample applications.
*Functional tests*
Functional tests are regular web applications with unit tests integrated into them. Application can be compiled as a regular web application as well as set of tests. Typical functional tests will do the following:
@ -96,27 +83,10 @@ Add this initialization logic to Startup.cs:
services.AddFunctionalTestTelemetryChannel();
```
*Running Tests*
You can run unit tests using Visual Studio.
You can run unit tests using .NET CLI from command line. The prerequisite to this is that you should make sure you have the latest version of .NET CLI. You can check the available runtime using the following command:
```
dotnet --version
```
If you are seeing that ```dotnet``` is not available (or defined), install .NET CLI: [.NET Core + CLI tools (SDK)](https://github.com/dotnet/cli).
After that you can open a developer command prompt, navigate to each test folder and run:
```
dotnet restore &REM Restores the dependency packages
dotnet build &REM Builds the test project
dotnet test &REM Runs the tests within the test project
```
You can also run all tests using the following Powershell from root directory.
```
powershell .\RunTestsCore.ps1
```
## Branches
- We follow the [Git Flow](http://nvie.com/posts/a-successful-git-branching-model) model.
- [master](https://github.com/Microsoft/ApplicationInsights-aspnetcore/tree/master) has the _latest_ version released on [NuGet.org](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore).
- [develop](https://github.com/Microsoft/ApplicationInsights-aspnetcore/tree/develop) has the code for the _next_ release.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

12
RunTests.cmd Normal file
Просмотреть файл

@ -0,0 +1,12 @@
@echo off
IF NOT DEFINED MSBUILD CALL findMsBuild.cmd
SET ToolsVersion=15.0
SET ProjectName=Msbuild.All
SET Configuration=Debug
SET Platform="Any CPU"
"%MSBUILD%" dirs.proj /nologo /m:1 /fl /toolsversion:%ToolsVersion% /flp:logfile=%ProjectName%.%Platform%.log;v=d /flp1:logfile=%ProjectName%.%Platform%.wrn;warningsonly /flp2:logfile=%ProjectName%.%Platform%.err;errorsonly /p:Configuration=%Configuration% /p:Platform=%Platform% /p:RunCodeAnalysis="False" /flp3:logfile=%ProjectName%.%Platform%.prf;performancesummary /flp4:logfile=%ProjectName%.%Platform%.exec.log;showcommandline /p:BuildSingleFilePackage=true /p:IsOfficialBuild=%IsOfficialBuild% /p:RunTests=True
pause

Просмотреть файл

@ -1,15 +0,0 @@
@echo off
call "%VS140COMNTOOLS%\VsDevCmd.bat"
SET ProjectName=Msbuild.All
REM Set the configuration to either release or debug based on the requirement. Accepts this as a parameter to build.cmd. By default it is chosen to be Release.
SET Configuration=Release
if NOT "%1"=="" (SET Configuration=%1)
SET Platform=Any CPU
SET NugetOrg_Feed=https://www.nuget.org/api/v2/
SET IsOfficialBuild=False
SET DefaultFeed=https://www.nuget.org/api/v2/
msbuild dirs.proj /nologo /m:1 /fl /flp:logfile="%ProjectName%.%Platform%.log";v=d /flp1:logfile="%ProjectName%.%Platform%.wrn";warningsonly /flp2:logfile="%ProjectName%.%Platform%.err";errorsonly /p:Configuration=%Configuration% /p:Platform="%Platform%" /p:RunCodeAnalysis="False" /flp3:logfile="%ProjectName%.%Platform%.prf";performancesummary /flp4:logfile="%ProjectName%.%Platform%.exec.log";showcommandline /p:BuildSingleFilePackage=true /p:IsOfficialBuild=%IsOfficialBuild% /p:RunTests=True
pause

12
buildDebug.cmd Normal file
Просмотреть файл

@ -0,0 +1,12 @@
@echo off
IF NOT DEFINED MSBUILD CALL findMsBuild.cmd
SET ToolsVersion=15.0
SET ProjectName=Msbuild.All
SET Configuration=Debug
SET Platform="Any CPU"
"%MSBUILD%" dirs.proj /nologo /m:1 /fl /toolsversion:%ToolsVersion% /flp:logfile=%ProjectName%.%Platform%.log;v=d /flp1:logfile=%ProjectName%.%Platform%.wrn;warningsonly /flp2:logfile=%ProjectName%.%Platform%.err;errorsonly /p:Configuration=%Configuration% /p:Platform=%Platform% /p:RunCodeAnalysis="False" /flp3:logfile=%ProjectName%.%Platform%.prf;performancesummary /flp4:logfile=%ProjectName%.%Platform%.exec.log;showcommandline /p:BuildSingleFilePackage=true /p:IsOfficialBuild=%IsOfficialBuild% /p:RunTests=False
pause

12
buildRelease.cmd Normal file
Просмотреть файл

@ -0,0 +1,12 @@
@echo off
IF NOT DEFINED MSBUILD CALL findMsBuild.cmd
SET ToolsVersion=15.0
SET ProjectName=Msbuild.All
SET Configuration=Release
SET Platform="Any CPU"
"%MSBUILD%" dirs.proj /nologo /m:1 /fl /toolsversion:%ToolsVersion% /flp:logfile=%ProjectName%.%Platform%.log;v=d /flp1:logfile=%ProjectName%.%Platform%.wrn;warningsonly /flp2:logfile=%ProjectName%.%Platform%.err;errorsonly /p:Configuration=%Configuration% /p:Platform=%Platform% /p:RunCodeAnalysis="False" /flp3:logfile=%ProjectName%.%Platform%.prf;performancesummary /flp4:logfile=%ProjectName%.%Platform%.exec.log;showcommandline /p:BuildSingleFilePackage=true /p:IsOfficialBuild=%IsOfficialBuild% /p:RunTests=False
pause

27
findMsBuild.cmd Normal file
Просмотреть файл

@ -0,0 +1,27 @@
@echo off
IF NOT DEFINED VSVERSION SET VSVERSION=15.0
IF DEFINED MSBUILD (
IF EXIST "%MSBUILD%" GOTO :eof
)
SET VSWHERE=..\packages\vswhere\tools\vswhere.exe
IF NOT EXIST "%VSWHERE%" nuget.exe install vswhere -NonInteractive -ExcludeVersion -Source https://www.nuget.org/api/v2 > nul
FOR /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -version %VSVERSION% -products * -requires Microsoft.Component.MSBuild -property installationPath`) DO (
SET MSBUILD=%%i\MSBuild\%VSVERSION%\Bin\MSBuild.exe
)
IF NOT DEFINED MSBUILD (
ECHO Could not find MSBuild %VSVERSION%. Please SET MSBUILD=^<path-to-MSBuild.exe^> and try again.
GOTO :eof
)
IF NOT EXIST "%MSBUILD%" (
ECHO vswhere.exe claims that MSBuild is at !MSBUILD! but it does not exist.
ECHO Please SET MSBUILD=^<path-to-MSBuild.exe^> and try again.
GOTO :eof
)
ECHO Using MSBuild from %MSBUILD%

Просмотреть файл

@ -23,6 +23,8 @@
<RepositoryUrl>https://github.com/Microsoft/ApplicationInsights-aspnetcore.git</RepositoryUrl>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.6' ">1.6.1</NetStandardImplicitPackageVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\src\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\src\$(MSBuildProjectName)</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<VersionPrefix>1.0.2</VersionPrefix>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net461;netstandard1.6</TargetFrameworks>
<DelaySign>true</DelaySign>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>ApplicationInsightsTypes</AssemblyName>
@ -10,8 +10,9 @@
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>ApplicationInsightsTypes</PackageId>
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -14,6 +14,7 @@
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.1</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

Просмотреть файл

@ -14,6 +14,7 @@
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<DependsOnNETStandard Condition=" '$(TargetFramework)' == 'net461'">true</DependsOnNETStandard>

Просмотреть файл

@ -12,6 +12,7 @@
<PackageId>FunctionalTestUtils</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -12,6 +12,7 @@
<PackageId>FunctionalTestUtils</PackageId>
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -15,6 +15,7 @@
<UserSecretsId>aspnet-MVCFramework45.FunctionalTests-60cfc765-2dc9-454c-bb34-dc379ed92cd0</UserSecretsId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.1</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<DebugType>pdbonly</DebugType>

Просмотреть файл

@ -15,6 +15,7 @@
<UserSecretsId>aspnet-MVCFramework45.FunctionalTests-60cfc765-2dc9-454c-bb34-dc379ed92cd0</UserSecretsId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<DebugType>pdbonly</DebugType>

Просмотреть файл

@ -13,6 +13,7 @@
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.1</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

Просмотреть файл

@ -15,6 +15,7 @@
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45+win8</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.1.1</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

Просмотреть файл

@ -14,6 +14,7 @@
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0</RuntimeFrameworkVersion>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\test\$(MSBuildProjectName)</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'=='' ">..\..\artifacts\obj\test\$(MSBuildProjectName)</IntermediateOutputPath>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>