Sorry, you need to enable JavaScript to visit this website.

You are here

Cant install package within visual studio

4 posts / 0 new
Last post

James's picture
by James

Cant install package within visual studio

Bit of a beginner question here but can someone please help me install the required packages for com.telstra.messaging... namespaces within Visual studio.

I have already installed the dependencies such as restsharp, newtonsoft, jsonsubtypes but I cannot find any nuget packages within visual studio package manager.

Am I going about this the wrong way?

Any help is much appreciated,

Thanks,

James

Vinodh's picture
by Vinodh

Cant install package within visual studio

Hi James,

This is Vinodh from the support team.  One of our developers will get back to you with an appropriate response. 

Appreciate your patience.

Regards
Vinodh

Chris's picture
by Chris

Hi James,

Hi James,

Please see the following that may assist you, although I am not using Visual Studio, rather VSCode.

I basically rolled a new dotnet app and installed the Telstra Messaging package from nuget, version 1.0.2 to test out the package can be installed from the nuget registry.

Let me know if you are having issues with this method, or are there any further error information you can provide?

# dotnet --info

macosc:osx ~/dev/telstra/dotnet-test-20200420 $ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  11.0
 OS Platform: Darwin
 RID:         osx.11.0-x64
 Base Path:   /usr/local/share/dotnet/sdk/5.0.202/

Host (useful for support):
  Version: 5.0.5
  Commit:  2f740adc14

.NET SDKs installed:
  3.1.113 [/usr/local/share/dotnet/sdk]
  5.0.202 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
macosc:osx ~/dev/telstra/dotnet-test-20200420 $ 

# dotnet new console

macosc:osx ~/dev/telstra/dotnet-test-20200420 $ dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Users/osx/dev/telstra/dotnet-test-20200420/dotnet-test-20200420.csproj...
  Determining projects to restore...
  Restored /Users/osx/dev/telstra/dotnet-test-20200420/dotnet-test-20200420.csproj (in 60 ms).
Restore succeeded.

macosc:osx ~/dev/telstra/dotnet-test-20200420 $ 

# dotnet run

macosc:osx ~/dev/telstra/dotnet-test-20200420 $ dotnet run
Hello World!
macosc:osx ~/dev/telstra/dotnet-test-20200420 $ 

# nuget install com.telstra.messaging -Version 1.0.2

macosc:osx ~/dev/telstra/dotnet-test-20200420 $ nuget install com.telstra.messaging -Version 1.0.2
Feeds used:
  /Users/osx/.nuget/packages/
  https://api.nuget.org/v3/index.json
  /Users/osx/dev/telstra/tls-messaging-dotnet/packages



Attempting to gather dependency information for package 'com.telstra.messaging.1.0.2' with respect to project '/Users/osx/dev/telstra/dotnet-test-20200420', targeting 'Any,Version=v0.0'
Gathering dependency information took 1.68 min
Attempting to resolve dependencies for package 'com.telstra.messaging.1.0.2' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'com.telstra.messaging.1.0.2'
Resolved actions to install package 'com.telstra.messaging.1.0.2'
Retrieving package 'com.telstra.messaging 1.0.2' from 'nuget.org'.
Retrieving package 'JsonSubTypes 1.2.0' from 'nuget.org'.
Retrieving package 'Newtonsoft.Json 10.0.3' from 'nuget.org'.
Retrieving package 'RestSharp 105.1.0' from '/Users/osx/.nuget/packages/'.
  GET https://api.nuget.org/v3-flatcontainer/jsonsubtypes/1.2.0/jsonsubtypes.1.2.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/jsonsubtypes/1.2.0/jsonsubtypes.1.2.0.nupkg 11ms
Installing JsonSubTypes 1.2.0.
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/10.0.3/newtonsoft.json.10.0.3.nupkg
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/10.0.3/newtonsoft.json.10.0.3.nupkg 10ms
Installing Newtonsoft.Json 10.0.3.
  GET https://api.nuget.org/v3-flatcontainer/com.telstra.messaging/1.0.2/com.telstra.messaging.1.0.2.nupkg
Adding package 'Newtonsoft.Json.10.0.3' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Added package 'Newtonsoft.Json.10.0.3' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Successfully installed 'Newtonsoft.Json 10.0.3' to /Users/osx/dev/telstra/dotnet-test-20200420
Adding package 'JsonSubTypes.1.2.0' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
  OK https://api.nuget.org/v3-flatcontainer/com.telstra.messaging/1.0.2/com.telstra.messaging.1.0.2.nupkg 213ms
Installing com.telstra.messaging 1.0.2.
Added package 'JsonSubTypes.1.2.0' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Successfully installed 'JsonSubTypes 1.2.0' to /Users/osx/dev/telstra/dotnet-test-20200420
Adding package 'RestSharp.105.1.0' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Added package 'RestSharp.105.1.0' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Successfully installed 'RestSharp 105.1.0' to /Users/osx/dev/telstra/dotnet-test-20200420
Adding package 'com.telstra.messaging.1.0.2' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Added package 'com.telstra.messaging.1.0.2' to folder '/Users/osx/dev/telstra/dotnet-test-20200420'
Successfully installed 'com.telstra.messaging 1.0.2' to /Users/osx/dev/telstra/dotnet-test-20200420
Executing nuget actions took 1.5 sec
macosc:osx ~/dev/telstra/dotnet-test-20200420 $

Screenshot

 

Chris's picture
by Chris

Hi James,

Hi James,

An alternative to installing from nuget could be to install from LocalSource.

To achieve this you can clone the Telstra Messaging .NET SDK and build from source, then package it into a new version and finally publish the package to LocalSource.

 

Clone and build from source control.

 

macosc:osx ~/dev/telstra/test-dotnet-20210420 $ git clone https://github.com/telstra/MessagingAPI-SDK-dotnet.git
Cloning into 'MessagingAPI-SDK-dotnet'...
remote: Enumerating objects: 223, done.
remote: Total 223 (delta 0), reused 0 (delta 0), pack-reused 223
Receiving objects: 100% (223/223), 103.29 KiB | 503.00 KiB/s, done.
Resolving deltas: 100% (133/133), done.
macosc:osx ~/dev/telstra/test-dotnet-20210420 $ cd MessagingAPI-SDK-dotnet
macosc:osx [master] ~/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet $ /bin/sh build.sh
[INFO] Target framework: net45
Mozilla Roots Importer - version 6.12.0.0
Download and import trusted root certificates from Mozilla's MXR.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

WARNING: mozroots is deprecated, please move to cert-sync instead.

Downloading from 'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt'...
Importing certificates into user store...
4 new root certificates were added to your trust store.
Import process completed.

Feeds used:
  /Users/osx/.nuget/packages/
  https://api.nuget.org/v3/index.json
  /Users/osx/dev/telstra/tls-messaging-dotnet/packages

Restoring NuGet package RestSharp.105.1.0.
Adding package 'RestSharp.105.1.0' to folder '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages'
Added package 'RestSharp.105.1.0' to folder '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages'
Restoring NuGet package Newtonsoft.Json.10.0.3.
Adding package 'Newtonsoft.Json.10.0.3' to folder '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages'
Added package 'Newtonsoft.Json.10.0.3' to folder '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages'
Restoring NuGet package JsonSubTypes.1.2.0.
Adding package 'JsonSubTypes.1.2.0' to folder '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages'
Added package 'JsonSubTypes.1.2.0' to folder '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages'
[INFO] Copy DLLs to the 'bin' folder
[INFO] Run 'mcs' to build bin/com.telstra.messaging.dll
src/com.telstra.messaging/Client/ApiClient.cs(503,58): warning CS1573: Parameter `collectionFormat' has no matching param tag in the XML comment for `com.telstra.messaging.Client.ApiClient.ParameterToKeyValuePairs(string, string, object)'
Compilation succeeded - 1 warning(s)
[INFO] bin/com.telstra.messaging.dll was created successfully
macosc:osx [master|?] ~/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet $ 

 

Bump the version, here I have bumped from 1.0.2 to 1.0.4 as there is a 1.0.3 locally.

Create a new 1.0.4 package.

 

macosc:osx [master|?] ~/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet $ cd src/com.telstra.messaging
macosc:osx [master|!?] ~/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging $ nuget pack -Build -OutputDirectory out com.telstra.messaging.csproj
Attempting to build package from 'com.telstra.messaging.csproj'.
MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/15.0/bin'.
Building project '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/com.telstra.messaging.csproj' for target framework '.NETFramework,Version=v4.5'.
Microsoft (R) Build Engine version 16.6.0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 20/04/2021 4:51:16 PM.
Project "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/com.telstra.messaging.csproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "bin/Debug/".
  Creating directory "obj/Debug/".
CoreCompile:
  /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Roslyn/csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/JsonSubTypes.1.2.0/lib/net45/JsonSubTypes.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/Microsoft.CSharp.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/mscorlib.dll /reference:/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll /reference:/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/RestSharp.105.1.0/lib/net45/RestSharp.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.ComponentModel.DataAnnotations.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.Core.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.Data.DataSetExtensions.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.Data.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.Runtime.Serialization.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.Xml.dll /reference:/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5-api/System.Xml.Linq.dll /debug+ /debug:full /filealign:512 /optimize- /out:obj/Debug/com.telstra.messaging.dll /subsystemversion:6.00 /target:library /utf8output /langversion:7.3 Api/AuthApi.cs Api/AuthenticationApi.cs Api/MessagingApi.cs Api/ProvisioningApi.cs Client/ApiClient.cs Client/ApiException.cs Client/ApiResponse.cs Client/Configuration.cs Client/ExceptionFactory.cs Client/GlobalConfiguration.cs Client/IApiAccessor.cs Client/IReadableConfiguration.cs Client/SwaggerDateConverter.cs Model/AuthgeneratetokenpostResponse.cs Model/DeleteNumberRequest.cs Model/ErrorError.cs Model/ErrorErrorError.cs Model/ErrorErrorError62.cs Model/ErrorErrorErrorError.cs Model/GetSubscriptionResponse.cs Model/InboundPollResponse.cs Model/Message.cs Model/MessageSentResponse.cs Model/MessageType.cs Model/MMSContent.cs Model/OAuthRequest.cs Model/OAuthResponse.cs Model/OutboundPollResponse.cs Model/OutboundPollResponseInner.cs Model/ProvisionNumberRequest.cs Model/ProvisionNumberResponse.cs Model/SendMmsRequest.cs Model/SendMmsRequestMMSContent.cs Model/SendSMSRequest.cs Model/Status.cs Properties/AssemblyInfo.cs "obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs"
  Using shared compilation with compiler from directory: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Roslyn
_CopyFilesMarkedCopyLocal:
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/RestSharp.105.1.0/lib/net45/RestSharp.dll" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/RestSharp.dll".
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/Newtonsoft.Json.dll".
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/JsonSubTypes.1.2.0/lib/net45/JsonSubTypes.dll" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/JsonSubTypes.dll".
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/RestSharp.105.1.0/lib/net45/RestSharp.xml" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/RestSharp.xml".
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.xml" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/Newtonsoft.Json.xml".
  Creating "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/obj/Debug//com.telstra.messaging.csproj.CopyComplete" because "AlwaysCreate" was specified.
CopyFilesToOutputDirectory:
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/obj/Debug/com.telstra.messaging.dll" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/com.telstra.messaging.dll".
  com.telstra.messaging -> /Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/com.telstra.messaging.dll
  Copying file from "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/obj/Debug/com.telstra.messaging.pdb" to "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug/com.telstra.messaging.pdb".
Done Building Project "/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/com.telstra.messaging.csproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.48
Packing files from '/Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/bin/Debug'.
Using 'com.telstra.messaging.nuspec' for metadata.
Found packages.config. Using packages listed as dependencies
Successfully created package 'out/com.telstra.messaging.1.0.4.nupkg'.
WARNING: NU5125: The 'licenseUrl' element will be deprecated. Consider using the 'license' element instead.
WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
- Add a dependency group for .NETFramework4.5 to the nuspec
macosc:osx [master|!?] ~/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging $ 

 

Create the new LocalSource.

 

macosc:osx ~/dev/telstra $ nuget list -Source LocalSource
The specified source 'LocalSource' is invalid. Please provide a valid source.
macosc:osx ~/dev/telstra $ 
macosc:osx ~/dev/telstra $ mkdir -p /Users/osx/dev/telstra/packages/dotnet
macosc:osx ~/dev/telstra $ nuget sources Add -Name "LocalSource" -Source /Users/osx/dev/telstra/packages/dotnet
Package source with Name: LocalSource added successfully.
macosc:osx ~/dev/telstra $ nuget list -Source LocalSource
No packages found.
macosc:osx ~/dev/telstra $ 

 

Push the previously created package to the LocalSource.

 

macosc:osx ~/dev/telstra $ nuget push -Source LocalSource /Users/osx/dev/telstra/test-dotnet-20210420/MessagingAPI-SDK-dotnet/src/com.telstra.messaging/out/com.telstra.messaging.1.0.4.nupkg
Pushing com.telstra.messaging.1.0.4.nupkg to '/Users/osx/dev/telstra/packages/dotnet'...
Your package was pushed.
macosc:osx ~/dev/telstra $ nuget list -Source LocalSourcecom.telstra.messaging 1.0.4
macosc:osx ~/dev/telstra $ 

 

Create a new test app.

 

macosc:osx ~/dev/telstra/test-dotnet-20210420 $ mkdir messaging-app-20210420
macosc:osx ~/dev/telstra/test-dotnet-20210420 $ cd messaging-app-20210420/
macosc:osx ~/dev/telstra/test-dotnet-20210420/messaging-app-20210420 $ dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Users/osx/dev/telstra/test-dotnet-20210420/messaging-app-20210420/messaging-app-20210420.csproj...
  Determining projects to restore...
  Restored /Users/osx/dev/telstra/test-dotnet-20210420/messaging-app-20210420/messaging-app-20210420.csproj (in 60 ms).
Restore succeeded.

macosc:osx ~/dev/telstra/test-dotnet-20210420/messaging-app-20210420 $ dotnet run
Hello World!
macosc:osx ~/dev/telstra/test-dotnet-20210420/messaging-app-20210420 $ 

 

Now you should be able to install the package in Visual Studio Package Manager.

 

Log in or register to post comments