Asp.Net v4 Webforms App has a dependency on Windows.Azure.Storage. This all works fine if i use WebDeploy to deploy it to Azure Websites.
Now i want to use a branch in my bitbucket repo to have it auto deploy from source control.
I set up the branch, linked azure to it, and then triggered a deploy.
But it fails, and this is in the Azure log...
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\DWASFiles\Sites\kdb\VirtualDirectory0\site\repository\Pfv.Kdb.UI\Kdb.UI.csproj]
Nuget has package restore enabled, and i checked nuget.targets to ensure that DownloadNugetExe condition is set to true.
Why is it failing to pull in the nuget dependencies?
I have just tried out creating a MVC4 app in VS2012 referencing Windows.Azure.Storage nuget package and succesfuuly pushed it from local git to windows azure without any issues.
I did not hit this issue. I have enabled nuget package restore and also included a .gitignore in to my git repo not to push binary and package files.
I also saw this with pushing the repo to WAWS.
remote: Successfully installed 'WindowsAzure.Storage 2.0.5.1'.
Related
I am having a hard time deploying my first .net core app with nuget references on the server. Locally, the app works absolutely fine (able to use nuget packages).
Apparently, there is no packages.config. I am using Dapper, Newtonsoft.Json, etc. Where is the project storing reference to these packages? There is no packages folder.
In the solutions folder, there is nuget.config file which for some reason is empty.
What should I add here
Unable to deploy app with nuget references on server
That because you are using the old version nuget restore task in the build pipeline, which only supports for the package management type packages.config not PackageReference.
That the reason why the old version task ask you to provide the path to the packages.config. The PackageReference is a follow-up product, so the previous version of nuget restore task does not support it.
Check the blog for some more details.
To resolve this issue, please use the V2 of the nuget restore task:
Note:
The PackageReference needs the nuget.exe 4.1 and above, please add
a NuGet tool installer to install the nuget version above 4.1.
Using .NET Core restore task should be also work for this issue.
Update:
Yes, using TFS 2016
Since you are using TFS 2016, you could try to use the command line to invoke the nuget.exe to restore the package instead of the nuget installer task:
Download the nuget.exe above 4.0 from the nuget.org, then set it on the TFS server.
Hope this helps.
You need to create a NuGet.config file that points to whatever NuGet feed you're using, add it to source control, and reference it in your build. I'll use the official feed for my example. This feed is already present by default if you're developing using Visual Studio, which might explain why the build runs locally but not on Azure DevOps.
At the very least, your NuGet.config file needs to look like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet.org Feed" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
In .NET Core, packages are now stored globally in your User directory. packages.config has been dropped in favor of the PackageReference node in a project file, so check your csproj to see the NuGets you're referencing.
You should use task dotnetcorecli task which has
#command: 'build' # Options: build, push, pack, publish, restore, run, test, custom
I have a project in C Sharp which build correctly in my local machine ( as well as in the one from my colleagues ). But when we try to configure the pipeline in Azure, in the step of Nuget restore everything stops and we get an error message stating that package "A" is not compatible with netcore 2.2, as well as package B,C,D,etc.
Why is it possible to see this error in Azure but not in my local? The project is setup to use netcore 2.2 and builds fine in my local machine.
Why is it possible to see this error in Azure but not in my local? The project is setup to use netcore 2.2 and builds fine in my local machine.
This error can occur with an outdated version of nuget. The default version of NuGet running in the VSTS pipeline was not the latest one.
So, to resolve this issue, there is a nuget version installer task which you can run as part of your build step to upgrade the version of nuget running in your build pipeline:
Besides, if update nuget version not resolve this issue, please check the SDK version on the build agent is same as your local, you can use the task Use .NET Core to update the SDK version.
Hope this helps.
I have a Docker build running as a task in an Azure devops build pipeline. Recently I had to add a git submodule to the project which contains a .Net Standard 2.0 library which references Entity Framework Core. Now when I run the build I get the following error message:
CSC : error CS8032: An instance of analyzer
Microsoft.EntityFrameworkCore.RawSqlStringInjectionDiagnosticAnalyzer
cannot be created from
/root/.nuget/packages/microsoft.entityframeworkcore.analyzers/2.2.1/analyzers/dotnet/cs/Microsoft.EntityFrameworkCore.Analyzers.dll
: Could not load file or assembly 'Microsoft.CodeAnalysis,
Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The system cannot find the file specified.. [/.../MyProject.csproj]
I have tried adding the Microsoft.CodeAnalysis nuget package to the project but that just causes more error messages. I have also tried adding Microsoft.Net.Compilers but that can only build under the full .Net framework so doesn't work for other areas of our pipeline.
The build agent being used is Hosted Ubuntu 1604 which should have the most up to date .NEt core SDK. Everything compiles locally.
Found the problem. I was targeting an old .Net version in the dockerfile.
Old command:
FROM microsoft/aspnetcore-build:2.0.0 as build
New command:
FROM microsoft/aspnetcore-build as build
I have many VSTS builds which has reference to one nuget package. Depending on primiary build we have to sometimes to upgrade/downgrade nuget package in VSTS build. We are doing this by copying packages.config with proper version, then we use nuget restore. My problem is that after upgrade/downgrade of nuget package .csproj file still have old version od package reference, so when build starts it still try to search for old reference from .csproj file and build fails.
I there any way to change .csproj file after nuget restore?
No, there is no way to update the .csproj during the build. You should change the .csproj locally and then build in VSTS.
Except the way manually changed the .csproj file, there has an easier way to change package versions correspondingly in .csproj. Execute below command in Package Manager Console window:
update-package -reinstall
So the workflow to use upgrade/downgrade nuget package version as below:
Change the versions in package.config file.
Run the command update-package -reinstall in in Package Manager Console window.
Commit and push/checkin the changes to remote repo.
Build your project in VSTS with the upgrade/downgrade nuget package version reference.
I'm trying to deploy an web application still on ASP.NET RC1 (DNX) to IIS. I went through all the Microsoft documentation, but I'm stuck on an issue. I'm getting this error when the application is starting up:
Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'Web' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
File name: 'Web' ---> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException: Startup.cs(104,39): DNX,Version=v4.5.1 error CS0012: The type 'Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
What does this mean? I am able to deploy to IIS on my local machine that I did the development on without any issues. However, just the server with IIS does not work.
How do I go about solving this error? The server is on Windows Server 2008 R2, and my local machine is Windows 7, if that helps.
I was able to resolve this problem using a workaround. It looks like it is an issue with Visual Studio 2015's Publish command. It looks like it does not have an option to publish into Nuget packages. This means the publish command outputs the source files. Hence the files still need to be compiled by the server.
I did not find out how to let the server compile the files correctly. However, I was able to resolve it by just compiling the code into Nuget packages before-hand. This can be done by using the dnu commandline tool.
dnu publish --out %folder% --no-source --include-symbols --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --configuration Release
The important part is the --no-source option, which will package into Nuget packages.