-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding .NET examples and deleting old NuGet examples (#375)
- Loading branch information
1 parent
e08cf48
commit 6117e2c
Showing
31 changed files
with
179 additions
and
741 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# .NET examples | ||
|
||
## Overview | ||
Artifactory provides full support for managing .NET/NuGet packages and ensures optimal and reliable access to nuget.org. It also allows aggregating multiple NuGet registries under a virtual repository Artifactory, which provides access to all your .NET/NuGet packages through a single URL for both upload and download. | ||
To work with NuGet repositories you need to use [JFrog CLI](https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory) and have your .Net/NuGet project configured to an Artifactory server. | ||
|
||
You may store exhaustive build information in Artifactory by running your .NET/NuGet builds with JFrog CLI. JFrog CLI collects build-info from your build agents and then publishes it to Artifactory. Once published, the build info can be viewed in the Build Browser under Builds. For more details on .NET/NuGet build integration using JFrog CLI, please refer to [Building .NET/NuGet Packages](https://jfrog.com/help/r/jfrog-cli/building-nuget-packages) in the JFrog CLI User Guide | ||
|
||
## These Examples | ||
These examples demonstrate how to build a .NET/NuGet project using JFrog CLI. The build does the following: | ||
|
||
1. Downloads its NuGet dependencies from Artifactory. | ||
2. Packs and uploads the built package to Artifactory. | ||
3. Records and publishes build-info to Artifactory. | ||
|
||
## Prerequisites | ||
* Install .NET Core 3.1 SDK or a later version - for full support you must have .NET CLI on your machine | ||
* Make sure the **dotnet** command is in your PATH (you can check by executing 'dotnet --version' and get a version number as a response). | ||
* Install [JFrog CLI](https://jfrog.com/getcli/) | ||
* Make sure your JFrog CLI version is 2.25.3 or above | ||
|
||
# Creating Repositories | ||
Create the following repositories on your Artifactory instance: | ||
|
||
1. A remote NuGet repository. Make sure the repository has *https://www.nuget.org/* configured as its URL (this is the default when creating the repository). | ||
2. A local NuGet repository. | ||
3. A virtual NuGet repository: | ||
- Include the remote and local repositories as part of the new virtual repository. | ||
- Set the new local repository as the **Default Deployment Repository** of the new virtual repository. | ||
|
||
## Running the Examples | ||
'cd' to one of the project's root directory and run the build using one of the following commands: | ||
|
||
```console | ||
Configure Artifactory: | ||
> jf c add --url=<JFROG_PLATFORM_URL> [credentials flags] | ||
|
||
Configure the project's repositories: | ||
> jf dotnet-config --repo-resolve=<NUGET_RESOLUTION_REPOSITORY> | ||
|
||
Restores the dependencies and tools of the project from Artifactory | ||
> jf dotnet restore --build-name=my-build --build-number=1 | ||
|
||
Execute 'audit' scan command. | ||
> jf audit | ||
|
||
Build the project with dotnet and resolve the project dependencies from Artifactory. | ||
> dotnet pack | ||
|
||
Upload the packages to a NuGet repository in Artifactory: | ||
> jf rt u "*.nupkg" <NUGET_DEPLOYMENT_REPOSITORY>/ --build-name=my-build --build-number=1 | ||
|
||
Collect environment variables and add them to the build info. | ||
> jf rt bce my-build 1 | ||
|
||
Publish the build info to Artifactory. | ||
> jf rt bp my-build 1 | ||
``` |
15 changes: 15 additions & 0 deletions
15
dotnet-examples/multi-example/ClassLibrary1/ClassLibrary1.csproj
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,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Platforms>AnyCPU;x64</Platforms> | ||
<Company>Some Compnay</Company> | ||
<Product>Some product</Product> | ||
<Copyright>Some copyright</Copyright> | ||
<Version>1.0.0</Version> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> | ||
<PackageReference Include="snappier" Version="1.1.0" /> | ||
</ItemGroup> | ||
</Project> |
13 changes: 13 additions & 0 deletions
13
dotnet-examples/multi-example/SharedProject1/SharedProject1.projitems
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' < '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
<HasSharedItems>true</HasSharedItems> | ||
<SharedGUID>64bb14a4-9a54-4444-8b83-e8405a1b83a2</SharedGUID> | ||
</PropertyGroup> | ||
<PropertyGroup Label="Configuration"> | ||
<Import_RootNamespace>SharedProject1</Import_RootNamespace> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
</ItemGroup> | ||
</Project> |
13 changes: 13 additions & 0 deletions
13
dotnet-examples/multi-example/SharedProject1/SharedProject1.shproj
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>64bb14a4-9a54-4444-8b83-e8405a1b83a2</ProjectGuid> | ||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" /> | ||
<PropertyGroup /> | ||
<Import Project="SharedProject1.projitems" Label="Shared" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" /> | ||
</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,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<Company>Some Company</Company> | ||
<Version>1.0.0</Version> | ||
<Product>Some product</Product> | ||
<Copyright>Foobar</Copyright> | ||
<Authors>Frederik</Authors> | ||
<Platforms>AnyCPU;x64</Platforms> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<OutputPath>bin\x64\Release\</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" Version="2.1.1" /> | ||
<PackageReference Include="Google.Cloud.Kms.V1" Version="2.0.0" /> | ||
</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,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.32106.194 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp1", "TestApp1\TestApp1.csproj", "{757C1D5A-BAA9-453F-B612-A0571390976B}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{757C1D5A-BAA9-453F-B612-A0571390976B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{757C1D5A-BAA9-453F-B612-A0571390976B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{757C1D5A-BAA9-453F-B612-A0571390976B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{757C1D5A-BAA9-453F-B612-A0571390976B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D9C89660-69F8-46E2-B9C4-78E9B505E8B1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {D8547989-C4F7-4FCC-95BB-F7478F7D2484} | ||
EndGlobalSection | ||
EndGlobal |
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,2 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
Console.WriteLine("Hello, World!"); |
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,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<RootNamespace>single_example</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="snappier" Version="1.1.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
nuget-example/MyLogger/MyLogger/Properties/AssemblyInfo.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.