Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio code and private nuget

I have a library that comes from a private nuget feed. I have the url and credentials for that but dont know how to connect to the feed properly with visual studio code. I am using dotnetcore framework.

I created a Nuget.Config file in the root of my console application with the feed url and username and password but this didn't seem to pick up the packages from that feed when imputting them in the project.json. Even doing a restore would produce errors.

Does anyone have an example of how they would set up a project to do this? I know it is not normal to have the Nuget.Config file in the project but this is a test project so would not live there once the project got past proof of concept.

My nuget.config looked like this

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="CustomRepo" value="https://nuget.feed/nuget/" />
    </packageSources>

    <!-- Used to store credentials -->
    <packageSourceCredentials>
        <CustomRepo>
            <add key="Username" value="something" />
            <add key="ClearTextPassword" value="thepassword" />
        </CustomRepo>
    </packageSourceCredentials>

      <!-- Used to disable package sources  -->
    <disabledPackageSources />
</configuration>
like image 318
Matt Avatar asked Feb 15 '17 12:02

Matt


1 Answers

Apoligies this is now resolved and working with the nuget.config file in the root folder. I dont know what I did. Only thing I did was re-type the whole xml but dont know what what would have done. Anyway it is working which is great.

like image 68
Matt Avatar answered Oct 22 '22 22:10

Matt