Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Refactoring documentation (#353)
Browse files Browse the repository at this point in the history
* Removing unused FalseErrors images

* Move console documentation to its own folder

* Change Introduction.md -> to README.md

* Adding links to the proper sections
  • Loading branch information
conniey authored Oct 13, 2016
1 parent 64afcc0 commit 678f6c0
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 218 deletions.
58 changes: 27 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,40 @@
This repository contains the source code for .NET Portability Analyzer tools and
dependencies.

## Usage
| Status | Latest Version |
| :----- | :------------- |
| ![][BuildStatus] | [![][Version]][myget] |

To use this tool, please refer to the [documentation](docs/HowTo/Introduction.md).
For a quick introduction, check out [this video on Channel 9][Channel 9 Video]:

[<img src="https://sec.ch9.ms/ch9/031c/f3d7672b-dd71-4a18-a8b4-37573c08031c/DotNetPortabilityAnalyzer_960.jpg" width="480" />][Channel 9 Video]

## Projects

| Project | Description |
| :------- | :----------- |
| ApiPort | Console tool to access portability webservice |
| ApiPort.Core | Cross-platform .NET Core application |
| ApiPort.Vsix | Visual Studio Extension |
| Microsoft.Fx.Portability [![][Version-Portability]][myget] | Provides common types for API Port |
| Microsoft.Fx.Portability.MetadataReader [![][Version-MetadataReader]][myget] | Implements a dependency finder based off of [System.Reflection.Metadata](https://github.com/dotnet/corefx/tree/master/src/System.Reflection.Metadata). The library will generate DocIds that conform to [these specifications](https://msdn.microsoft.com/en-us/library/fsbx0t7x.aspx). |
| Microsoft.Fx.Portability.Offline [![][Version-Offline]][myget] | Provides access to data in an offline setting so network calls are not needed |
| Microsoft.Fx.Portability.Reporting.Html [![][Version-Reporting Html]][myget] | Provides an HTML report for ApiPort (used in offline mode) |
| Microsoft.Fx.Portability.Reporting.Json [![][Version-Reporting Json]][myget] | Provides a JSON reporter for ApiPort (used in offline mode) |

## Using this Repository

* Install [Visual Studio 2015 with Update 3][Visual Studio 2015]
* Install [.NET Core 1.0.1](https://dot.net/core)

### ApiPort.Core

__Prerequisites__
## Documentation

* Install [.NET Core 1.0.1](https://dot.net/core)
* [Introduction](docs/HowTo)
* [Platform Portability](docs/HowTo/PlatformPortability.md)
* [Breaking Changes](docs/HowTo/BreakingChanges.md)
* [.NET Portability Analyzer (Console application)](docs/Console)
* [.NET Core application](docs/Console/README.md#using-net-core-application)
* [.NET Portability Analyzer (Visual Studio extension)](docs/VSExtension)

__Compiling, Debugging and Running__
## Projects

* Change __Platform__ to `x64`
* Compile solution
* Run/debug the solution by:
* Executing: `dotnet.exe ApiPort.exe [arguments]`
* Debug `ApiPort.Core` project in Visual Studio
| Project | Description |
| :------ | :---------- |
| ApiPort | Console tool to access portability webservice |
| ApiPort.Core | Cross-platform .NET Core application |
| ApiPort.Vsix | Visual Studio Extension |
| Microsoft.Fx.Portability | Provides common types for API Port |
| Microsoft.Fx.Portability.MetadataReader | Implements a dependency finder based off of [System.Reflection.Metadata][System.Reflection.Metadata]. The library will generate DocIds that conform to [these specifications][DocId]. |
| Microsoft.Fx.Portability.Offline | Provides access to data in an offline setting so network calls are not needed |
| Microsoft.Fx.Portability.Reporting.Html | Provides an HTML report for ApiPort (used in offline mode) |
| Microsoft.Fx.Portability.Reporting.Json | Provides a JSON reporter for ApiPort (used in offline mode) |

## How to Engage, Contribute and Provide Feedback

Expand All @@ -61,7 +58,7 @@ for more details.

* [How to Contribute][Contributing Guide]
* [Contributing Guide][Contributing Guide]
* [Developer Guide]
* [Developer Guide][Developer Guide]

You are also encouraged to start a discussion on the .NET Foundation forums!

Expand All @@ -74,17 +71,16 @@ For an overview of all the .NET related projects, have a look at the

This project is licensed under the [MIT license](LICENSE).

[BuildStatus]: https://devdiv.visualstudio.com/_apis/public/build/definitions/0bdbc590-a062-4c3f-b0f6-9383f67865ee/484/badge
[Channel 9 Video]: https://channel9.msdn.com/Blogs/Seth-Juarez/A-Brief-Look-at-the-NET-Portability-Analyzer
[Contributing Guide]: https://github.com/dotnet/corefx/wiki/Contributing
[Developer Guide]: https://github.com/dotnet/corefx/wiki/Developer-Guide
[DocId]: https://msdn.microsoft.com/en-us/library/fsbx0t7x.aspx
[Issues-Open]: https://github.com/Microsoft/dotnet-apiport/issues?q=is%3Aopen+is%3Aissue
[PR]: https://github.com/Microsoft/dotnet-apiport/pulls
[PR-Closed]: https://github.com/Microsoft/dotnet-apiport/pulls?q=is%3Apr+is%3Aclosed
[PR-Open]: https://github.com/Microsoft/dotnet-apiport/pulls?q=is%3Aopen+is%3Apr
[myget]: https://www.myget.org/gallery/dotnet-apiport
[Version-Portability]: https://img.shields.io/myget/dotnet-apiport/v/Microsoft.Fx.Portability.svg
[Version-MetadataReader]: https://img.shields.io/myget/dotnet-apiport/v/Microsoft.Fx.Portability.MetadataReader.svg
[Version-Offline]: https://img.shields.io/myget/dotnet-apiport/v/Microsoft.Fx.Portability.Offline.svg
[Version-Reporting Html]: https://img.shields.io/myget/dotnet-apiport/v/Microsoft.Fx.Portability.Reports.Html.svg
[Version-Reporting Json]: https://img.shields.io/myget/dotnet-apiport/v/Microsoft.Fx.Portability.Reports.Json.svg
[System.Reflection.Metadata]: https://github.com/dotnet/corefx/tree/master/src/System.Reflection.Metadata
[Version]: https://img.shields.io/myget/dotnet-apiport/v/Microsoft.Fx.Portability.svg
[Visual Studio 2015]: http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx
171 changes: 171 additions & 0 deletions docs/Console/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# .NET Portability Analyzer (Console application)

The console tool helps you determine how flexible your application. The tool
understands the following commands:

* `ApiPort.exe analyze <options>`
* Analyzes the portability of an application
* [Examples](#apiportexe-analyze-scenarios)
* `ApiPort.exe listTargets`
* Lists .NET platforms available for analysis
* `ApiPort.exe listOutputFormats`
* Lists available report output formats
* `ApiPort.exe DocIdSearch <options>`
* Searches for matching docIds

## `ApiPort.exe analyze` Scenarios

Arguably the most important function of the tool is its ability to analyze an
assembly. This can take in a file, collection of files, or a directory of
assemblies.

**Analyzing a file against specific targets and outputting an HTML report**

```
ApiPort.exe analyze -f Foo.dll -t ".NET Framework, Version=4.6.2" -t
".NET Standard, Version=1.6" -r HTML -o AnalysisReport.html
```

The `-f` flag followed by a path represents the file or directory that the
analysis should be performed on; in this case, it is `Foo.dll`. The multiple
uses of `-t` followed by target names tells the tool what .NET platforms we want
to analyze the input assembly(ies) against. `-r` is the output format of the
report. `-o` is the output name for that report.

So, our analysis will be performed on `Foo.dll` against
`.NET Framework, Version=4.6.2` and `.NET Standard, Version=1.6` and output as
an HTML file, `AnalysisReport.html`.

**Analyzing a directory against the default targets and outputting default
report format**

```
ApiPort.exe analyze -f C:\git\Application\bin\Debug
```

This will analyze all assemblies that exist under `C:\git\Application\bin\Debug`
recursively, and analyzes those assemblies against the default .NET platforms.
(**Note:** The default platforms can be obtained by running `ApiPort.exe
listTargets` and looking for targets that have an (\*) in them.)

**Analyzing a directory and show breaking changes**

```
ApiPort.exe analyze -f C:\git\Application\bin\Debug -b
```

The `-b` flag will show any APIs that may have different behavior between
versions of .NET Framework due to breaking changes that have been made. The
entire list of breaking changes in .NET Framework can be found by examining
[Application Compatibility in the .NET Framework][Breaking Changes]. For the
list of breaking changes we analyze against, look [here](BreakingChanges.md).

**Analyzing a directory and show any non-portable APIs**

```
ApiPort.exe analyze -f C:\git\Application\bin\Debug -p
```

The `-p` flag will highlight any APIs that are not portable against the default
target .NET platforms. (No explicit `-t` arguments were specified, so we use the
default targets.)

## Using .NET Core application

The portability analyzer has a version that targets .NET Core. Possible reasons
for using the .NET Core application include:

* Working on machine without .NET Framework 4.6 installed
* Working on a non-Windows OS

### Compiling, Debugging and Running

**From Commandline**

1. Execute `build.cmd`
2. Go to `bin\Release\ApiPort.Core\netcoreapp1.0`
3. Go to either `x64` or `x86` folder
4. Execute `dotnet.exe ApiPort.exe`

**In Visual Studio 2015**

1. Change **Platform** to `x64` or `x86`
2. Compile solution
3. Set `ApiPort.Core` as Start-up Project
4. Start debugging (F5)

### Troubleshooting

**Problem: The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing
from your computer.**

Solution: Install [Visual Studio 2015 C++ Redistributable][VS2015 C++ Redistributable].

## Alternate modes

The tool by default will gather the results and submit to a webservice that will
analyze the data to determine which APIs need to be addressed. For full details
on this process, please read the [privacy policy][Privacy Policy]. There are
two alternate modes that can be used to alter this workflow.

### See the data being transmitted

The first option is to output the request to a file. This will result in an
output that shows what data is being transmitted to the service, but provides no
details as to API portability or breaking changes. This is a good option if you
would like to see what data will be collected.

In order to enable this mode, create a file `unity.config` and place it in the
same directory as `ApiPort.exe`. Add the following contents:

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<typeAliases>
<typeAlias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
<typeAlias alias="IApiPortService" type="Microsoft.Fx.Portability.IApiPortService, Microsoft.Fx.Portability" />
<typeAlias alias="FileOutputApiPortService" type="ApiPort.FileOutputApiPortService, ApiPort" />
</typeAliases>
<container>
<register type="IApiPortService" mapTo="FileOutputApiPortService" >
<lifetime type="singleton" />
</register>
<instance name="DefaultOutputFormat" value="json" />
</container>
</unity>
</configuration>
```

Now, when you run, it will output a file with the information that is sent to
the .NET Portability service.

### Run the tool in an offline mode

Another option is to enable full offline access. This mode will not get
automatic updates and no official releases of it are available. In order to use
this mode, the solution must be manually built. To do so, please follow these
steps:

1. Clone the project: `git clone https://github.com/Microsoft/dotnet-apiport`
2. Build the project: `build.cmd`.

*Note: This command must be used as it gathers the correct assemblies for offline mode. Building in VS does not do this.*

3. Go to `bin\release\ApiPort.Offline`
4. Run `ApiPort.exe` from this directory as normal.

Additional reports can be generated in offline mode. Any implementation of
`Microsoft.Fx.Portability.Reporting.IReportWriter` can be used. Add an entry to
`unity.config` following the pattern of the HTML and json writers. The offline
mode will pick it up and allow reports to be returned in custom formats.

Note that offline mode is not supported for .NET Core versions of ApiPort.

[Breaking Changes]: https://msdn.microsoft.com/en-US/library/dn458358(v=vs.110).aspx
[Issue #2311]: https://github.com/dotnet/cli/issues/2311
[Privacy Policy]:/docs/LicenseTerms/Microsoft%20.NET%20Portability%20Analyzer%20Privacy%20Statement.txt
[VS2015 C++ Redistributable]: https://www.microsoft.com/en-us/download/details.aspx?id=53587
Binary file removed docs/DocImages/FalseErrors.png
Binary file not shown.
Loading

0 comments on commit 678f6c0

Please sign in to comment.