Category: nuget

.NET Core global tool CD/CI with AzureDevops to Nuget

I want to can deploy automatically from GitHub  to Nuget a .NET Global ( or local ) tool.

It is enough simple;

1. Get an API key from GitHub

2. Goto to your AzureDevops , settings ( down the page ) and connect with a new Service Connection AzureDevops to GitHub ( name: nugetAndrei)

3. Make an yaml file similar with this:

# ASP.NET Core

# Build and test ASP.NET Core web applications targeting .NET Core.

# Add steps that run tests, create a NuGet package, deploy, and more:




vmImage: ‘VS2017-Win2016’


buildConfiguration: ‘Release’

deployNuget: ‘0’


– script: |

    cd AOPRoslyn

    dotnet tool restore

displayName: ‘restore tool’

– script: dotnet restore AOPRoslyn\AOPRoslyn.sln

displayName: ‘restore project’

– script: |

    cd AOPRoslyn

    dotnet tool run pwsh -f ./makenuget.ps1

displayName: ‘powershell to version and pack’

– script: dotnet build AOPRoslyn\AOPRoslyn.sln –configuration $(buildConfiguration)

displayName: ‘dotnet build $(buildConfiguration)’

– script: dotnet pack AOPRoslyn\aopCmd\aop.csproj  –no-build -o $(Build.ArtifactStagingDirectory) /p:Configuration=$(buildConfiguration) # –verbosity Detailed

displayName: ‘dotnet pack ‘

– task: PublishBuildArtifacts@1


pathtoPublish: ‘$(Build.ArtifactStagingDirectory)’

artifactName: drop1

# – task: NuGetAuthenticate@0

#   inputs:

#     nuGetServiceConnections: ‘nugetAndrei’

– task: NuGetCommand@2

condition: and(succeeded(), eq(variables[‘deployNuget’], ‘1’))


command: push

nuGetFeedType: external

packagesToPush: ‘$(Build.ArtifactStagingDirectory)/**/*.nupkg’

publishFeedCredentials: ‘nugetAndrei’

displayName: ‘dotnet nuget push’

# – task: DotNetCoreCLI@2

#   displayName: Push Nuget Package

#   inputs:

#     command: custom

#     custom: nuget

#     arguments: >

#       push $(Build.ArtifactStagingDirectory)\*.nupkg

#       -s

#       -k $(NuGetSourceServerApiKey)

You can find the source here:

Entity Framework 6 Record and play use : Unit Testing ( part 2 of 5)


Part 1 : What is EF record and play : 

Part 2: EF Record and play use: Testing :

Part 3: EF Record and play use: Make demo: 

Part 4: EF Record and play use: Record user Sql when a bug occurs:

Part 5: EF record and play: conclusions:


Let’s suppose that we have a program that have Departments and Employees.

And we want to make sure that, when we add an employee, the department must exists.

We can ensure this from database ( by foreign key) but we can pro-actively search for the department and throw a more meaningful validation .

More, I like more validation than errors.

So, let’s suppose that in the Validation for the Employee we must check in the database for the IdDepartment to see if there is such a department.

How could we make a test for that runs without a database ?

With some trick:  we first Record with a database  – then we can Play the file – and we do not need anymore the database. The test is self contained. 


Let’s see in action here


            #region set record EF
            var record = new InterceptionRecordOrPlay(@"", ModeInterception.Play);

            var e= new Employee();
            e.ValidateEmployee = true;
            e.IDDepartment = 60000;
            var err= e.Validate(null).ToArray();
            Assert.AreEqual(1, err.Length);

Source code is available at


There is also a NuGet package at

Browser history–part 5–conclusions

This is the part 5 of 5 of my implementing of a MVC Browser history

MVC browser history – idea

Browser history –2 – implementing, small bugs

Browser history 3–trying to Nuget – modifications in order to can be transformed from an application to a component

Browser history 4–NuGet again -  finally Nuget deployment

Browser history–part 5–conclusions  – conclusions



I have reached the (partial) final for my MVC Browser History .  It has started as a simple application – and now it is a NuGet component ready to be used and a demo project at app harbour

What can do for you as a MVC programmer :

  • The component can be integrated in any MVC application easily (via NuGet)
  • you will have a page that displays the list of links that are part of the project and the top 5(configurable) accessed pages
  • You can have this filtered per user basis – or per administrator( small changes in the controller action)
  • It can save the history in memory or in sql server database( configurable in History page, ) or you can make your saving data by implementing  IBrowserUserHistoryRepository

    You can see in action at app harbour

    If you use, please send me an email.

    If you worry about code source, you can find at github . If you want to improve, feel free to participate Winking smile

    Browser history 4–NuGet again

    This is the part 4 of 5 of my implementing of a MVC Browser history

    MVC browser history – idea

    Browser history –2 – implementing, small bugs

    Browser history 3–trying to Nuget – modifications in order to can be transformed from an application to a component

    Browser history 4–NuGet again – finally Nuget deployment

    Browser history–part 5–conclusions – conclusions

    Prior to Nuget, I think that will be better if the user of my app could play with sql server or memory implementation. So the new GUI is here:



    But how could I show to the user where it is saved? Easy – to the history page



    And now I can make the NuGet Package .

    In order to can download a controller and not overwrite the Home controller, I must create a controller of its own – so make a modification : History Controller

    Now adding dependencies, fighting with NuGet Explorer,

    In the first test  StructureMap dll reference missing and the Views folder was in the wrong place.

    In the second test , I discovered that I was missing adding the following essential lines

    filters.Add(new BrowserHistory.Models.BrowserUserHistoryFilter());
    ObjectFactory.Configure(ce => ce.For<IBrowserUserHistoryRepository>().Use<BrowserUserHistoryRepositoryMemory>());


    So I began reading how to add to global.asax at nuget package installing time – and coming with this:

    Adding code,testing -  another 15 minutes.

    Adding readme.txt – in order to explain what have I done and how to use it – another 30 minutes.

    Now it is ready to be used by you.

    If you want to test it, you can see in action at
    Detailed history of creating project at
    Source code at


    Next time will do a summary of what I have done in order to build this simple utility project.

    Clearer as Nuget package

    It was not so difficult to make Clearer as NuGet package. Just analyzing MVC Sitemap package done the trick. So the package looks like:



    You can install from or download a sample application

    ( What he does ?

    In every application there are some variables that are set by the ASP.NET application( ASP.NET_SessionId cookie ) and some that are set by the programmer( cached data in Application/Session/Cache/Cookies and so on).
    I wanted every time to have a page where I can “clear” / delete those – and not found. So it’s the Clearer project.
    Possible uses:
    For developers – when they want to see what happens when a cache item no longer exists
    For developers – to put to site admins some simple tool to reload data from Cache/Application . Just edit the LoadAll function to load only Cache/Application
    For developers – to test easily the session. Just delete ASP.NET_SessionId cookie – you will get another one when you refresh the page.


    So please install Nuget package from and tell me if it works!


    My first Nuget project: Hydrating.  Also a Codeplex project : 

    It can re-make an object by adding items of “property/value”

    It comes in 2 flavors: .NET 2.0 ( reflection ) and .NET 4  ( expression).

    Sample Usage:

    Sample usage:
    var Model = new HydrateGeneric<MyModel>();
    Model.AddNewProperty("OneProp", "bb");
    Model.AddNewProperty("newData.StartDate", DateTime.Now.AddDays(1).ToString());
    Model.AddNewProperty("newData.SecondProp", "AB");
    Model.AddNewProperty("newData.aOne.ThirdProp", "XXX");
    var data = Model.NewObject();


    It comes from a Paulo Morgado idea from . However, his initialization does not specify property name – so it’s rather error prone if you do not specify properties + values in right order. I have somewhat improved by


    Model. AddNewProperty("OneProp", "bb");



    Andrei Ignat weekly software news(mostly .NET)

    * indicates required

    Please select all the ways you would like to hear from me:

    You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

    We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.