Is there a way I can connect my Visual studio to Azure Artifact source feed with PAT token? I need to add packages to my project
Solution:
Create a nuget.config file in the root of your project (where sln is). I used the Package Manager Console to run the command "dotnet new nugetconfig"
In the nuget.exe file, I replaced content with following
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="FeedName" value="artifact URL" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json"/>
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSourceCredentials>
<FeedName>
<add key="Username" value="User" />
<add key="ClearTextPassword" value="%PATTokenEnvrionmentVariable%" />
</FeedNamet>
</packageSourceCredentials>
</configuration>
Then I ran "dotnet restore" and restarted Visual studio
Related
I've got a problem with building .NET 5 solutions using docker compose build or docker build.
Image which i'm using for building is:
mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim
The problem is that when I'm trying to build it on my machine (MacOS Monterey, intel) I've got following error with restoring nuget packages from the private feed:
#19 6.349 Failed to download package 'System.Runtime.CompilerServices.Unsafe.4.5.1' from 'https://XXXX.pkgs.visualstudio.com/_packaging/96ca4348-f8c1-4150-b19f-3dab0cf807bf/nuget/v3/flat2/system.runtime.compilerservices.unsafe/4.5.1/system.runtime.compilerservices.unsafe.4.5.1.nupkg'.
#19 6.349 Connection refused (pyvvsblobprodsu6weus63.blob.core.windows.net:443)
#19 6.349 Connection refused
#19 6.357 Failed to download package 'Microsoft.Azure.Storage.Common.11.2.3' from 'https://XXXX.pkgs.visualstudio.com/_packaging/96ca4348-f8c1-4150-b19f-3dab0cf807bf/nuget/v3/flat2/microsoft.azure.storage.common/11.2.3/microsoft.azure.storage.common.11.2.3.nupkg'.
#19 6.357 Connection refused (wg0vsblobprodsu6weus89.blob.core.windows.net:443)
#19 6.357 Connection refused
I'm copying nuget.config with credentials in dockerfile like
COPY nuget.config /
Here is my nuget.config copied to the container:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet V3" value="https://api.nuget.org/v3/index.json" />
<add key="DDDDD" value="https://XXXX.pkgs.visualstudio.com/_packaging/DDDDD/nuget/v3/index.json" />
</packageSources>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<config>
<add key="repositoryPath" value="packages" />
</config>
<packageSourceCredentials>
<DDDDD>
<add key="Username" value="SomeUsername" />
<add key="ClearTextPassword" value="SomePassword" />
</DDDDD>
</packageSourceCredentials>
</configuration>
Commands which i'm using to build containers:
docker compose up -d
docker build . -F API/Dockerfile
It's failing for both of them.
Can anybody tell me what's wrong? Maybe it's something with my machine setup?
Self answer for people having the same issue as I had:
The problem was the lack of this line in the nuget config:
in config section like:
<config>
<add key='maxHttpRequestsPerSource' value='10' />
<add key="repositoryPath" value="packages" />
</config>
After adding this key, everything is working as expected.
Keep in mind that your value for maxHttpRequestsPerSource may be different (less or more) so I advise doing a few experiments with other values.
I have an issue in VS2015 where adding a NuGet source is not working.
The picture below shows the source. The URL and package name is correct and working (I can successfully push packages to the repo).
The problem is when I add it, check the checkbox, and select "Update" and "Save", it does not activate the source. When I go back into the dialog, the checkbox is unchecked. It remains unchecked no matter what I do.
I think this is a GUI issue, the problem seems to be it simply is not enabling it. Is there a config option in a project file I can manually this package source?
(Note that "NAME" and "http://myrepo.com" are not the real source name and url, but I have verified they are correct by pushing to it successfully.
Edit:
I checked the NuGet.config file and there is indeed an entry in the file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="NAME" value="http://myrepo.com" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
I had been running VS as administrator due to using a local IIS instance which requires administrator privileges, magicandre1981 pointed out that NuGet.config needs write permissions, so I gave full access to the folder to normal users (I believe the NuGet.config file was generated under the administrator context therefore lacking normal user permissions).
This by itself did not solve the issue, but doing a Nuget Package Restoreafterwards, caused the NuGet feed to display again.
I am new to VS 2013 and recently got introduced to a feature called Browser Link. I think it's an awesome feature provided by microsoft.
I am not able to get the connections.
Following steps I did
Created a new Empty MVC project
Created a controller Home and Action Index
Created a view Index.cshtml.
Solution was in debug mode.
Ran the solution.
Following is the web.config settings for the project
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
</configuration>
I have gone through the process Microsoft Explained on it's site http://go.microsoft.com/fwlink/?LinkId=313770.
To register the Page Inspector's Runtime add the following line to your web.config.
<system.web>
<compilation debug="true" targetFramework="4.5.1">
<assemblies>
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,Version=1.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
I have a solution from Visual Studio 2015, using the .NET Framework 4.6. Locally, I can compile without any problem and I am using NuGet in its latest version (3.1).
When I check-in and then build using Visual Studio Online, I get errors like this:
Plumbing\DALContainerRegistration.cs (1): The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you
missing an assembly reference?)
Storage\BlobStorage.cs (5): The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you
missing an assembly reference?)
I understand that I am missing these references on the Build server, but I don't see how I can resolve this. In the two examples above, I get the Enterprise library and Azure storage library from NuGet, so there is apparently no reason why it would not work.
I have a NuGet.config at the root of my sln and here is its content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Do you have any idea what can be wrong? If you need any other info, please let me know.
You need to enable Restore NuGet Packages. In VSO Build vNext you can do this in the Build step.
To create a new build definition:
I could solve this by modifying the NuGet.config file as follow:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="nuget.orgv3" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
Please am fairly new to programming in asp.net and now am following the steps in a textbook to design an e-commerce web application.
I am using UrlRewritingNet dll from http://www.urlrewriting.net/ to create search engine friendly urls on the application. I unzipped the urlrewritingnet zip and copied its dll file to my application's bin folder. I also copied its urlrewritingnet.xsd file to my project folder. The textbook am working from uses the dll from urlrewriter.net with different configurations which I tried in my project but it didn't work. The textbook also uses visual web developer 2005. Am programming in visual studio 2012 (C#). For now am trying to rewrite the url of my catalogs page so as to test if the configuration in my web.config file is correct. I'm doing the configuration in my web.config, not in IIS. I do not want any IIS configurations because am imagining a scenario where I don't have access to the server.
I keep getting an internal server error that displays like this:
HTTP Error 500.22 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
this is the url which I want to rewrite: http://localhost:1036/Catalog.aspx?DepartmentID=1
This is my config file:
<configuration>
<configSections>
<section name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission ="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
</configSections>
<urlrewritingnet
rewriteOnlyVirtualUrls="true"
contextItemsPrefix="QueryString"
defaultProvider = "RegEx"
defaultPage = "Default.aspx"
xmlns="http://www.urlrewriting.net/schemas/config/2006/07" >
<rewrites>
<add name="Rule1"
provider="RegEx"
virtualUrl="^.*-d([0-9]+)/?$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Catalog.aspx?DepartmentID=$1"
ignoreCase="true" />
</rewrites>
</urlrewritingnet>
<appSettings>
<add key="MailServer" value="smtp.gmail.com"/>
<add key="MailUsername" value="engr.ejikeeze#gmail.com"/>
<add key="MailPassword" value="keeplooking"/>
<add key="MailFrom" value="engr.ejikeeze#gmail.com"/>
<add key="EnableErrorLogEmail" value="false"/>
<add key="ErrorLogEmail" value="engr.ejikeeze#gmail.com"/>
<add key="ProductsPerPage" value="6"/>
<add key="ProductDescriptionLength" value="60"/>
<add key="SiteName" value="BalloonShop"/>
</appSettings>
<connectionStrings>
<add name="BalloonShopConnection" connectionString="server = (local)\SQLEXPRESS; Database = BalloonShop; User = balloonshop; password=ecommerce" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/>
<customErrors mode="RemoteOnly" defaultRedirect="Oops.aspx" />
<pages theme="BalloonShopDefault">
<controls>
<add src="~/UserControls/DepartmentsList.ascx" tagName="DepartmentsList" tagPrefix="BSUC"/>
</controls>
</pages>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
Pls I need you lovely guys to help me out. Am really stuck. I've searched all round the internet for over 4 days in search of solution but to no avail. Thanks in anticipation.
You can checkout the following link:url-rewriting-in-Asp-Net