Automapper Failing when take latest from TFS - tfs

My team mate installed AutoMapper latest version in his workstation using
nuget in all the projects whereever referenced in the solution. In
package.config we can see the automapper latest version. It was building
properly in her machine. But when I take latest and run the project in my
machine, the Automapper failed but I can see in packages.config the new
version. But in reference the Automapper is showing not found with an yellow
icon.

It seems that the NuGet Package didn't restored Automapper successfully.
Possible duplicate with this question:TFS Can't Restore NuGet Package
Try to make sure both package sources are added to your NuGet.config file. Also ensure both sources are 'active'.
<configuration>
<packageSources>
<add key="nuget.org"
value="https://www.nuget.org/api/v2/" />
<add key="example.com"
value="http://example.com/feed/nuget/" />
</packageSources>
<activePackageSource>
<add key="All"
value="(Aggregate source)" />
</activePackageSource>
</configuration>

Related

NuGet.Config file Transforms?

Is there a way to transform a Nuget.Config file in a solution based on the solution configuration? I have one packageSource that I only use for resolving dependencies on my local machine. I don't want this packageSource to be used at all when I build the solution on the build server.
<?xml version="1.0" encoding="utf-8"?>
<packageSources>
<clear />
<add key="MyLocalFeed" value="\\MyNetworkShare" />
<add key="CompanyFeed" value="http://companynugetserver/" />
</packageSources>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
In the above sample Nuget.Config, I only want to use "MyLocalFeed" on my local development server ("Debug" configuration in the solution). Once all changes are checked-in and built on the build server, the "MyLocalFeed" packageSource should no longer appear/be ignored. I have to keep the <clear /> statement in the config, per company requirements.
No, we cannot transform a Nuget.Config file in a solution based on the solution configuration.
Based on your description you can use the "MyLocalFeed" for local development, and remove "MyLocalFeed" in the Nuget.Config file and use that file in TFS build to restore the packages from CompanyFeed.
But please note that the local packages may have other dependencies which are not included in CompanyFeed...
So we recommend using the same NuGet feed for development and CI, or you push all the related packages into theCompanyFeed.

How can I prevent repositories.config from being automatically added to TFS?

I am using NuGet v2.8.60610.756. Every time I build a solution in VS2013, packages/repositories.config is automatically added to source control (TFVC) as a pending change. How can I prevent this?
I have added a .tfignore file at the solution root with the following entries, but it does not make a difference.
## Ignore the NuGet packages folder in the root of the repository
packages
packages/*
I have also set disableSourceControlIntegration to true in .nuget/NuGet.config
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>

Deploying Bitbucket to Azure Web Site: add private nuget package server

I have set up a website on Azure to deploy through a Bitbucket repository. The process fails when it tries to install nuget packages which are stored on a private nuget server, not nuget.org. Is there a way to specify where to restore the nuget packages from so that Azure can restore these packages?
You can add a custom NuGet.config file at the same level as your .SLN file.
You can then make the following modifications (assuming that your private feed requires authentication, create a set of credentials which only are used for this site):
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<packageSources>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
<add key="custom_package_source" value="https://custom_package_source/nuget/v1/FeedService.svc/" />
</packageSources>
<disabledPackageSources />
<packageSourceCredentials>
<custom_package_source>
<add key="Username" value="CustomUsername" />
<add key="ClearTextPassword" value="CustomPassword" />
</custom_package_source>
</packageSourceCredentials>
When you deploy via Kudu, this should allow the build process to discover your private feed, authenticate & restore your packages.
If you do not require authentication against your private feed, remove the <packageSourceCredentials> element.

NuGet web.config.transform issue

I'm creating a custom package that needs to modify the web.config file of the destination application, but my config changes never appear in the destination app after installation.
Here's my web.config.transform file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="AppInstalled" value="false"/>
</appSettings>
</configuration>
This key in the appSettings section is never applied.
Here's my nuspec file:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>http://mvcapp.codeplex.com/license</licenseUrl>
<projectUrl>http://mvcapp.codeplex.com/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<tags>mvc app</tags>
</metadata>
<files>
<file src="\bin\Release\MvcApp.MVC3.dll" target="lib" />
<file src="NuGet\Content\ajax-loader.gif" target="Content" />
<file src="NuGet\Content\web.config.transform" target="web.config" />
<file src="NuGet\Views\Install\Index.aspx" target="Views\Install\Index.aspx" />
</files>
</package>
Here's the command I run to package the project from the VS 2010 command prompt:
nuget pack mvcapp.csproj
Any Ideas?
Thanks.
The web.config.transform file needs to go into the content folder:
<file src="NuGet\Content\web.config.transform" target="content" />
I know this is an old question, but it's one of the top google results when searching for why a web.config.transform won't apply, so I hope I'm not out of place applying this here.
TLDR; - clear your nuget files from the target project's packages directory (or I assume up the version number) between iterations of testing.
Full Version;
I had this problem as well. I could see using NuGet Package explorer that my project was packaged appropriately. I had my web.config.transform under "content", and my libs under their respective lib folders. The dll's were getting deployed, the web.config.transform wasn't getting applied.
The destination project I was testing with was under source control, so I'd add the nuget package, see what happened, then rollback the whole directory. However I didn't notice that the packages folder wasn't under source control, so the folders from my initial package install were in there. I wasn't upping the version number in the package nuspec, either, because I didn't think I had to.
Ultimately I ended up having to clear my nuget package's directory from the project's packages directory, forcing the next nuget install attempt to recreate them.

Problem using microsoft-mvc-helpers package with custom membership provider in MVC3

I've created an MVC 3 web application project and used the Nuget Package Manager to install the microsoft-mvc-helpers package. In order to get that to work I had to add a reference to WebMatrix.Data and WebMatrix.WebData (setting "Copy Local" to true).
When I try to run my project I get the following error:
this method cannot be called during
the application's pre-start
initialization stage.
And it points to the following section in my web.config (specifically the add tag):
<membership defaultProvider="ICNMemberProvider" userIsOnlineTimeWindow="60">
<providers>
<clear />
<add name="ICNMemberProvider" type="Website.Providers.ICNMemberProvider" />
</providers>
</membership>
This was working before I installed the microsoft-mvc-helpers package and works if I uninstall it. Any ideas why my customer Membership Provider and the helpers package would cause this error?
I found the answer to this question on another stack overflow question:
ASP.NET: This method cannot be called during the application's pre-start initialization stage
You just have to add the following to the appSettings section of your web.config:
<add key="enableSimpleMembership" value="false"/>
<add key="autoFormsAuthentication" value="false"/>

Resources