I developed a web api (.net core) in windows and hosting it in ubuntu server. My application needs packages from private nuget repository.
I have set the package source as nuget config -Set RepoName=http://sample-nuget-repo.net/api/odata.
I have verified with nuget resources.
When I run dotnet restore, it gives me failure messages.
Please help me if i am missing anything.
what is the location of nuget.config file in ubuntu (as in windows it is appdata/nuget/nuget.config)
You can define custom package sources in a NuGet.Config file in the root directory of your source control repository containing your source code. Then you do not need to configure it on every machine.
NuGet.Config:
<configuration>
<packageSources>
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
<add key="sample-nuget-repo" value="http://sample-nuget-repo.net/api/odata" />
</packageSources>
</configuration>
When you run a nuget restore solution.sln or dotnet restore solution.sln the solution's directory will be checked first for a NuGet.Config file, then the directory above, all the way back to the root directory. Finally the NuGet.Config under the user's profile will be checked.
Related
I am building a self-contained .Net Core worker service which I run as a windows service. Now I want to create an installe using Wix, however when I try to harvest all the needed DLL's for installation I get the following error:
An error occurred loading a configuration file: The parameter 'exePath' is invalid.
I've read this post which states the heat.exe might be broken. But I downloaded the tools via NuGet (3.11.2) which should theoretically be fine. My Beforebuild target looks as following:
<Exec Command="dotnet publish ..\Parlando.PVS.PackingSlipService\Parlando.PVS.PackingSlipService.csproj -c $(Configuration) -r win10-x86" />
<ItemGroup>
<LinkerBindInputPaths Include="%(ProjectReference.RootDir)%(ProjectReference.Directory)bin\$(Configuration)\%(ProjectReference.TargetFrameworkIdentifier)\win10-x86\publish" />
</ItemGroup>
<HeatDirectory
DirectoryRefId="INSTALLFOLDER"
OutputFile="$(ProjectDir)\HeatGeneratedFileList.wxs"
Directory="..\Parlando.PVS.PackingSlipService\bin\Release\netcoreapp3.1\win10-x86\publish"
ComponentGroupName="HeatGenerated"
ToolPath="$(WixToolPath)"
AutogenerateGuids="True"
SuppressCom="True"
SuppressRegistry="True"
SuppressFragments="True"
SuppressRootDirectory="True"
NoLogo="true" />
<ItemGroup>
<Compile Include="$(ProjectDir)\HeatGeneratedFileList.wxs" Condition="'%(ProjectReference.IsDotnetSDKProject)' == 'True'" />
</ItemGroup>
This should generate a .wxs file that I reference in the Product.wxs file when installing the service. My product.wxs does so as followed:
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="Parlando.PVS.PackingSlipService"
DisplayName="Parlando.PVS.PackingSlipService"
Description="Service installed by Parlando to create packingslips and invoices."
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<ServiceControl
Id="ServiceInstaller"
Start="install"
Stop="both"
Remove="uninstall"
Name="Parlando.PVS.PackingSlipService" />
</Component>
<ComponentRef Id="HeatGenerated" />
How can i use the heat.exe in such a way that I can access the DLL list in my Product.wxs and install my service via MSI?
Apperantly this error has nothing to do with the provided settings for the Wix installer, but rather the machine that Wix is installed on.
After testing my program on a different machine, all worked fine.
I am not able to build image due to failing of restoration of private nuget.
Below is my compose file:
FROM microsoft/aspnetcore-build AS builder
WORKDIR /source
WORKDIR solnname
RUN ["cp", "../NuGet.Config","/root/.nuget/NuGet/NuGet.Config"]
RUN dotnet restore
RUN dotnet publish --output /app/ --configuration Release # build runtime
image FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=builder/app .
ENTRYPOINT ["dotnet", "solnname.dll"]
And I have defined my own NuGet.Config in same folder as below:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="LocalPackage" value="http://localhost:58222/nuget" />
<add key="Test Source" value="c:\packages" />
</packageSources>
</configuration>
But getting error that
/usr/share/dotnet/sdk/2.1.3/NuGet.targets(103,5): error : The local source '/sou
rce/c:\packages' doesn't exist. [/source/solnname.csproj]
If you are using Linux containers on a Windows environment then the local packages path is not going to be valid since you are using a backslashes to your local package path which is not valid in the Linux container. You will need to mount the path and change the resolution using forward slashes.
Has anyone had success building an ASPNET5 application in VSTS with a local (not public facing) Nuget server as a feed? Following these steps: https://msdn.microsoft.com/Library/vs/alm/Build/azure/deploy-aspnet5 I can see the script restoring but it always errors out on my local package. I am sure I am configuring something wrong. This is what I have tried:
Add a Nuget Installer task with a arg to my solution and NuGet arguments nugete.exe -source "https://www.nuget.org/api/v2/;http://mynugetserver" (and I tried including no Nuget arguments and including a Nuget.config in the root of my solution). However, the build runs into a an exception saying it cant find the local url: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The remote name could not be resolved: 'mydomain'. Okay I understand that, but I do I get it to recognize a local URL?
After researching I thought I would have to use the Package Manager Extension for VSTS. So I loaded my packaged on there successfully, but when I included that package URL in my Nuget.config I get a bunch of unauthorized responses from the PreBuild.ps1 because it is trying to look at the VSTS package URL too. And that is where I am now.
Current Nuget.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<config>
<!--DO I NEED TO INCLUDE MY PROXY INFOR HERE I AM BEHIND ONE AT WORK-->
</config>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<activePackageSource>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</activePackageSource>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="Local" value="https://vstsurl/DefaultCollection/_packaging/Local/nuget/v3/index.json" />
<add key="Company Nuget Gallery v2" value="http://mydomain/nuget/api/v2" />
</packageSources>
</configuration>
UPDATE
if I use the Package Manager on VSTS these are the warnings / exceptions all which seem to come from the local feed. not sure why it is using the local feed for all the external packages
System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
... other exceptions here
----------
Restore failed
If you are using the build agent hosted by VSTS and your nuget server is in local (Cannot access from internet), the package restore will fail since the build agent cannot find your nuget server. You'd either configure your nuget server so that it can be accessed from internet or deploy your own build agent in the same intranet with your nuget server.
I want to host my ASP.NET 5 project which uses MVC 6 and Entity Framework 7 on Amazon free micro instance.
I can't find any step-by-step manual on how to host ASP.NET 5 projects on IIS, all materials just mention that this is possible but without any guides.
Basically, I'm deploying to local folder and then copying to newly created site, but nothing is working.
Unfortunately, I can't use Azure as it only has one month free trial, not a year.
I'm using Visual Studio 2015 Preview to create ASP.NET 5 projects. I don't think that's difficult to deploy on IIS now.
First publish your website by publishing it as file system in VS 2015 preview, then copy the published folder to your server, create an application in IIS and set the application folder to the wwwroot folder (rather than the root folder), that's all.
Be aware, check if "Microsoft.AspNet.Server.IIS" exists in your website project.json before publishing it.
Edit:
there should be a web.config in wwwroot folder, the content of web.config may be like this (with precompile option when publishing):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta1" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta1" />
<add key="kre-clr" value="CoreCLR" />
<add key="kre-app-base" value="..\approot\packages\Rvc.PopUpSite\1.0.0\root" />
</appSettings>
</configuration>
or like this (without precompile option):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta1" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta1" />
<add key="kre-clr" value="CoreCLR" />
<add key="kre-app-base" value="..\approot\src\Rvc.PopUpSite" />
</appSettings>
</configuration>
Please notice the value of kre-app-base. Occasionally its value is empty string after publishing in Visual Studio.
I had the same problem with DNX Beta 4.
If someone has the same problem :
You have to target x64 framework (Target DNX Version) when you publish your website in Visual Studio 2015 RC and write "XXX\wwwroot" in Physical Path in your IIS website configuration.
1. First you need to publish the site to the file system:
2. Create a new application in IIS:
3. Unzip the file you've created in step 1 in the website directory from step 2. The folder should look like:
4. You may also need to install DNVM (formerly KVM) and the DNX Runtime Environment (formerly KRE):
Install the DNVM - dotnet version Manager (KVM)
Install the DNX runtime environment inside DNVM (KRE)
You can use the File system publish method. Follow these steps:
1/ Generate in a folder with Visual studio the .dll files
2/ Create a website in IIS manager and give in the path to your folder
I found what I've missed, I need to change url to my public DNS in projct.json file:
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://ec2-54-68-21-4.us-west-2.compute.amazonaws.com/
then after uploading site to Amazon I need to run web.cmd in site root
Here is how the deployed content looks like after publishing (on Azure Website):
/approot/packages - NuGet packages
/approot/src - all the source files from the solution
/approot/global.json - a list of global NuGet packages
/wwwroot/bin/AspNet.Loader.dll - the only .dll file in wwwroot folder
/wwwroot/css - front-end code
/wwwroot/lib - front-end code
/wwwroot/web.config - auto-generated
web.config generated during publishing
I'm wondering, how to make it deploy only the compiled output and not the source files?
If you are publishing through VS 2015, then make the following selection to not deploy the source files:
If you are not using VS, then you can use kpm pack command to achieve this. For example, following is the command that VS uses to create the package to deploy (You can enable Detailed logging in Tools | Options | Projects and Solutions | Build and Run, to see this)
"C:\Users\kiranchalla\.kre\packages\kre-clr-x86.1.0.0-beta2-10690\bin\kpm.cmd" pack --runtime KRE-CLR-x86.1.0.0-beta2-10690 --out "C:\Users\kiranchalla\AppData\Local\Temp\AspNetPublish\WebApplication5-91" --wwwroot-out wwwroot --no-source --configuration Release --quiet
Some info:
The effect of the above is that now your application is pre-compiled and you should see a package under the packages folder and the kre-app-base flag in web.config points to this package. Example:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="kpm-package-path" value="..\approot\packages" />
<add key="bootstrapper-version" value="1.0.0-beta1" />
<add key="kre-package-path" value="..\approot\packages" />
<add key="kre-version" value="1.0.0-beta2-10690" />
<add key="kre-clr" value="CLR" />
<add key="kre-app-base" value="..\approot\packages\WebApplication5\1.0.0\root" />
</appSettings>
</configuration>