Microsoft App Center add external package - xamarin.forms

How I do add packages sources in my project?
In my Visual Studio, i go to tools -> options -> Nuget Package Manager -> Package Sources.
And add the package information that in this case is not in Nuget. Now in the App Center I did not find this information and with this my project does not compile

You can create a NuGet.config file as described in the docs.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget" value="https://api.nuget.org/v2/index.json" />
<add key="MyGet" value="https://www.myget.org/F/MyUsername/api/v2/index.json" />
<add key="MyAuthNuget" value="https://nuget.example.com/v2/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSourceCredentials>
<MyAuthNuget>
<add key="Username" value="$USER_VARIABLE" />
<add key="ClearTextPassword" value="$PASSWORD_VARIABLE" />
</MyAuthNuget>
</packageSourceCredentials>
</configuration>

Maybe this will also help somebody. For me the above solution haven't worked. So what I've discovered - always check if official source of packages is same as in your config. For now nuget source have changed to version 3:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<activePackageSource>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
</activePackageSource>
</configuration>

Related

Not able to use Azure Package Source with Net Interactive Notebook

Using Net 6 I have the project structure:
nuget.config
project.code-workspace
- Core
Core.csproj
- Api
Api.csproj
- Sim
notebook.ipynb
My Nuget.config is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="mysrc" value="https://pkgs.dev.azure.com/me/_packaging/mysrc/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<moget>
<add key="Username" value="mysrc" />
<add key="ClearTextPassword" value="password" />
</moget>
</packageSourceCredentials>
</configuration>
The package mysrc is working fine with my Core and Api project.
But when I run the Net Interactive Notebook I get the error:
Error: /usr/local/share/dotnet/sdk/6.0.101/NuGet.targets(130,5): error : Unable to load the service index for source ... : error :
Response status code does not indicate success: 401 (Unauthorized).
How to solve this?

Configure multiple source in Nuget.config in Linux (RHEL7)

I am trying to configure multiple Nuget source in nuget.config. Nuget.config is added to the root of the project. With same config I can successfully dotnet build my app on my macbook but when I run the same config in linux I get the following error.
/opt/rh/rh-dotnet31/root/usr/lib64/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Unable to load the service index for source https://gitlab.xxxyy.gov/api/v4/projects/id/packages/nuget/index.json [/var/www/folder/member/Member.sln]
/opt/rh/rh-dotnet31/root/usr/lib64/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Response status code does not indicate success: 401 (Unauthorized). [/var/www/netcoreapp3.1/member/Member.sln]
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="gitlab" value="https://gitlab.senate.gov/api/v4/projects/449/packages/nuget/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<packageSourceCredentials>
<gitlab>
<add key="Username" value="xyz" />
<add key="ClearTextPassword" value="dhdhdhdh" />
</gitlab>
</packageSourceCredentials>
</configuration>
I figured it out. I had to manually add source nuget source Add -Name "gitlab" -Source "https://gitlandomain/api/v4/projects/id/packages/nuget/index.json" -UserName xyz#domain.com -Password ddhdhdgdgsgv
After this dotnet nuget restore/build works like charm.

Web.Config Transformation Not Working

Using VS 2k15, ASP.NET 4.5
My Transform is not working. I was looking in preview and the files are the same. Then I figured maybe I had to deploy to see transformation. So I set up a custom Deploy to my desktop, using the Deploy Configuration. Checked the web.config after publishing that, still matching the original.
Any idea what I'm doing wrong?
I know when I do the preview I get a warning at the top of the preview that says..."
These files have different encodings. Left file: Unicode (UTF-8) without signature. Right file: Unicode (UTF-8) with signature. You can resolve the difference by saving the right file with the encoding Unicode (UTF-8) without signature.
However, when I choose Save Options and save the Deploy file with no signature (so they're matching) the message still comes up. Just not sure what's going on. Any ideas why I can't this transform to work?
Web.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="fileLibrary" value="c:\vsoProjects\localFiles\rlFileLibrary" />
</appSettings>
<connectionStrings>
<add name="appConnString" connectionString="Data Source=(LocalDb);Initial Catalog=DevDB;User ID=*****;Password=*****;Connect Timeout=300" />
</connectionStrings>
</configuration>
Web.ContDeploy.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="fileLibrary" value="R:\rlFileLibrary" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
</appSettings>
<connectionStrings>
<add name="appConnString" connectionString="Data Source=myserver.test.com;Initial Catalog=DeployDB;User ID=*****;Password=*****;Connect Timeout=300" xdt:Transform="SetAttributes(connectionString)" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
I'm not an expert on the transform, but my (working) transform for the appSettings key has this signature:
<appSettings>
<add key="datafolder" value="D:\sites\removedpath\App_Data\" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
which is slightly different than yours
I found the problem. This project was converted a while back from asp.net 2.x to 4.5.
The web.config still had an attribute up in the configuration section.
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
...
</configuration>
You can see it up top in the code I posted. I didn't realize it was still there. After all that time banging my head against my desk I just removed that attribute, preview transform, and voila it was there! Also deploys properly as well.

Oracle.ManagedDataAccess: TNS:could not resolve the connect identifier specified

I'm getting the following error while trying to connect to an Oracle database from a new ASP.NET MVC 4 application: "ORA-12154: TNS:could not resolve the connect identifier specified". I'm using the Oracle.ManagedDataAccess DLL (version 4.121.1.0) to try to connect to an Oracle 10g database. Here's the thing - I have an integration test assembly that is successfully connecting to the database using this minimal App.config:
<connectionStrings>
<add name="OracleConnection" connectionString="DATA SOURCE=TNS_NAME;PASSWORD=xxx;PERSIST SECURITY INFO=True;USER ID=xxx" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>
However, if I try to run my web app with all the crazy Web.config settings, I'm getting the error "ORA-12154: TNS:could not resolve the connect identifier specified". What am I doing wrong? Why is my config for the integration test assembly so simple and the Web.config so complex? Here's the pertinent sections of my Web.config (taken from Deploying and Configuring ODP.NET to work without installation with Entity Framework):
custom configSection:
<configSections>
<section name="oracle.manageddataaccess.client"
type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
the corresponding config section:
<oracle.manageddataaccess.client>
<version number="*">
<edmMappings>
<edmMapping dataType="number">
<add name="bool" precision="1"/>
<add name="byte" precision="2" />
<add name="int16" precision="5" />
</edmMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>
custom system.data node:
<system.data>
<DbProviderFactories>
Remove in case this is already defined in machine.config
<remove invariant="Oracle.DataAccess.Client" />
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client"
description="Oracle Data Provider for .NET, Managed Driver"
type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
EntityFramework node:
<entityFramework>
<defaultConnectionFactory type="Victoria.Data.OracleConnectionFactory, EntityFramework" />
</entityFramework>
Update 1: After reading through http://docs.oracle.com/cd/E16655_01/win.121/e17732/featConfig.htm#ODPNT8161, I tried modifying my Web.config oracle.manageddataaccess.client to the following and it works. However, it doesn't seem right to have the connectionString node referencing the TNS name AND this extra reference to the same TNS Names file.
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="SIEBMATS" descriptor="(DESCRIPTION=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.yyy.zzz)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = siebmats)))" />
</dataSources>
<edmMappings>
<edmMapping dataType="number">
<add name="bool" precision="1"/>
<add name="byte" precision="2" />
<add name="int16" precision="5" />
</edmMapping>
</edmMappings>
</version>
</oracle.manageddataaccess.client>
One thing you can try is having the connection string like so:
connectionString="Data Source=//SERVER:PORT/INSTANCE_NAME;USER=XXX;PASSWORD=XXX".
Useful references here:
http://www.connectionstrings.com/oracle/
http://docs.oracle.com/cd/E51173_01/win.122/e17732/featConnecting.htm#ODPNT169
This has also helped me while having problems with EF:
Deploying and Configuring ODP.NET to work without installation with Entity Framework
Hope to have helped.
My problem was in incorrect/incomplete Oracle Driver version, had 11.2.0 installed. I add another 12.2.0 version, didn't change anything in web.config and it worked as charm
I suggest to try the solution proposed by #kolbasov in another thread but about the same problem: https://stackoverflow.com/a/20050462/9390179
It worked for me:
<oracle.manageddataaccess.client>
<version number="*">
<settings>
<setting name="TNS_ADMIN" value="C:\Oracle\product\11.1.0\client_1\network\admin" />
</settings>
</version>
</oracle.manageddataaccess.client>

ReflectionTypeLoadException in Simple.Data using PostgreSql

I am trying to open PostgreSQL connection but getting ReflectionTypeLoadException while opening connection.
Please help me out to solve this problem by providing code or let me know how to remove this exception.
Code i am using so far is below:
**/* Connection String
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="superuserDatabase" value="postgres"/>
</appSettings>
<system.data>
<DbProviderFactories>
<clear/>
<add name="Npgsql Data Provider"
invariant="Npgsql"
description=".Net Framework Data Provider for Postgresql Server"
type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="Simple.Data.Properties.Settings.DefaultConnectionString"
connectionString="host=localhost;port=5432;database=SimpleData;user id=postgres;password=P#ssw0rdsa;pooling=false"
providerName="Npgsql" />
<add name="Test"
connectionString="host=localhost;port=5432;database=SimpleData;user id=postgres;password=P#ssw0rdsa;pooling=false"
providerName="Npgsql" />
</connectionStrings>
</configuration>**
*/
I am getting following exception when trying to open connection in POSTGRESQL
var namedDb = Database.OpenNamedConnection("Test").Demo.All();
ReflectionTypeLoadException
This ReflectionLoadTypeException is most often caused because the DLLs you're using aren't up to date so the dependency chain fails. Use nuget to update your project with the latest DLLs. v0.16.2.2 of the PostgreSql provider requires
Simple.Data.Core (≥ 0.12.2.2)
Simple.Data.Ado (≥ 0.12.2.2)
Npgsql (≥ 2.0.11)
(via Mark Rendle) Try explicitly installing 0.16.2.2 of Simple.Data.Ado first, then installing the Postgres package.

Resources