Traditionally, nunit-console.exe has been included in the repository and on the build server (or any other machine) this EXE was called from some build script.
Now that the NUnit.Runners package is available I wonder how this could be used from a psake build script. It is a solution-level package so it doesn't leave any trace in packages.config and cannot be auto-restored as other project-level packages so I guess one would need to call Install-Package from the psake script, wait for the download and then execute the unit tests? Hopefully this download can be run only once and it will not slow down the build every time it runs. Or will it?
Just ran into this myself. Quite easy to fix as follows:
Get latest version of the Nuget Package Manager extension. I'm on 1.8 at the moment.
Add the Nunit.Runners package to your solution
Copy the element related to the runner from packages.config under your .nuget folder into the packages.config file of your unit test project
From now on, when you build, Nuget will pull down the Nunit.Runners packages if it is not on the machine. I then reference the Nunit runner from the package in my command line build.
I have this working in a little project I did for a TeamCity build light on Github. Packages.config in the unit test project has been modified as discussed above. You can look at the MSBuild file to see how I run tests from the command line. (build.proj, which references some targets and properties contained in the repository's tools\msbuild folder). You will need the latest Nuget Package Manager installed before you try to build in VS.NET or from the command line (clicktobuild.bat).
You should be able to port the idea of how to run Nunit console from the right location into psake quite easily.
I have created an issue with nuget developers, and proposed a fix.
Modify the nuget.targets file with the following changes:
In <PropertyGroup Condition=" '$(OS)' == 'Windows_NT'"> add this element:
<SolutionLevelPackagesConfig>$([System.IO.Path]::Combine($(SolutionDir), ".nuget\packages.config"))</SolutionLevelPackagesConfig>
In <PropertyGroup> add this element:
<RestoreSolutionLevelCommand>$(NuGetCommand) install "$(SolutionLevelPackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreSolutionLevelCommand>
In <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites"> add this element before the RestoreCommand for WinNT:
<Exec Command="$(RestoreSolutionLevelCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)') And Exists('$(SolutionLevelPackagesConfig)')" />
This made my msbuild to restore the solution level packages.
This doesn't answer your question, but may be of use to someone facing a similar problem. I ran into the same problem trying to set up a TeamCity build. I worked around this by reverting to an older version of nunit.
NUnit 2.5.10.11092 still has the nunit exe's in the nuget package.
Related
When importing existing library projects into an existing solution (after I copied them locally from somewhere else), when I try to install or uninstall a Nuget package through the package manager, it justs builds my solution showing me all of the errors I have because the package is not installed. It does nto try to install or uninstall the package. Why is it building my project instead of just installing / uninstalling the bloody package?
Why is it building my project instead of just installing /
uninstalling the bloody package?
It's not default behavior of VS IDE itself.
As for VS2017, if we install a normal package using Package Manager UI, VS will check the compatibility between the package to consume and the current project. If they're compatible, the package will be installed successfully, if not, VS will throw nuget error like NU1202 or others in ErrorList window.
But I'm sure for VS2017, installing/uninstalling won't call a build.
Possible causes of the issue and corresponding suggestions:
1.This behavior results from one third-party extension.
Reset all VS settings => disable all the third-party extensions => restart VS to check if the issue persists. If after the check you find this issue results from one extension, you need to make sure if the extension provides one option to turn on/off the auto-build. Or you may need to disable/uninstall the extension temporarily and contact the author of the extension to post the issue.
You may get more details for trouble-shooting from this similar issue.
2.Custom script(.ps1,.targets) from one specific nuget package causes this.
The authors can place powershell script and PackageID.targets in .nupkg when generating packages. Some of these scrips will execute when we install the package, others will execute when we uninstall the package. See similar issue here.
You can create a new simple console project TestProject in TestProject solution. Then right-click solution=>add=>Existing project to import a new external project. Now let's install the Newtonsoft.Json package to check if the issue disappears. If the issue disappears in new project with Newtonsoft.Json package. I think it indicates one special package you try to install/uninstall may cause the issue.
Hope all above helps and feel free to let me know if there's any update.
I'm trying to install some Package on Visual Studio 2017 using NuGet, I need the Microsoft.EntityFrameworkCore package but when I try to install, it fails because of a long path/repertory name. This path is supposed to be shorter than 260 chars (or 248 if it's a repertory name), but I can't figure out which path/repertory they're talking about (there is no more info in the error). So I did look to my C# project Path and this one is only 130 chars.
Do you have any solution ? I'm on a school project and I really need these packages , hope you guys can help me.
Nuget install faill because of a path which is to long
When we install the nuget package via NuGet to our project, NuGet will download the package from the nuget source and save it in the local cache.
For .net framework project, NuGet will save the package in the \packages folder in the solution folder by default. In this case, if we have the long file name issue, we could move the solution to the root of C disk, just like magicandre1981 said.
Besides, if you are interested in nuget, we could overwrite the repositoryPath value in the nuget.config file to change the default path of \packages folder.
Check details from this thread and the document.
For .net core/standard project, NuGet will save the package in the global folder C:\Users\<UserName>\.nuget\packages. In this case, if we have long username, we may get this issue, to resolve it, we could rename our username or we could change the default global package folder.
Check this thread for details.
Hope this helps.
Our team has a private Package Feed set up in Visual Studio Online. We can push the latest version of a library we are working on to the feed, and then see it in our NuGet package manager in VS2017.
In the last few weeks, this process has become unreliable, and we cannot determine why.
Steps:
A developer builds nuget a package locally.
We push the package to our feed using the command line
nuget.exe push -Source "VSO-Feed" -ApiKey VSTS ..\Project\bin\Debug\Project.0.1.1-alpha.nupkg
Command returns success
We can see new new package version under "Packages" in VSO
NuGet Package Manager in VS 2017 cannot find the new package
Attempts to update the .csproj file manually to reference the new version sometimes succeed, but just as frequently the project build fails with a message like
Unable to find package Project with version (>= 0.1.1-alpha)
Found 243 version(s) in vso-feed [ Nearest version: 0.1.0-alpha ]
After an indeterminate period of time, usually at least 45 minutes, it suddenly works again!
Has anyone else experienced this? Our searches have come up empty.
Visual Studio 2017 - Saying "Package restore failed" while updating the NuGet packages as following:
Issue with updating NuGet packages (VS2017)
To resolve this issue, first, you should make sure your Target Framework that is used to compile your android application, Use Latest Platform (Android 8.1 (Oreo)).
Check source: Understanding Android API Levels
Second, if you confirm your Target Framework is Android 8.1 (Oreo), then Select all packages checkbox, and click Update button:
After that, all nuget packages can be updated to latest version.
The reason for this issue:
To find the reason for this issue, change the MSBuild build log to Detailed, Tools->Options->Projects and Solutions->Build and Run->MSBuild project build output verbosity:Detailed.
When you update one of those default nuget packages, in the output you will get following dependencies conflict errors:
NU1107: Version conflict detected for Xamarin.Android.Support.Compat.
Reference the package directly from the project to resolve this issue.
App1.Android -> Xamarin.Android.Support.Design 27.0.2 ->
c (= 27.0.2) App1.Android ->
Xamarin.Android.Support.v7.AppCompat 25.4.0.2 ->
Xamarin.Android.Support.Compat (= 25.4.0.2).
That means when you update the default package Xamarin.Android.Support.Design to 27.0.2, one of its dependencies, Xamarin.Android.Support.Compat also need to be updated to 27.0.2. However, other nuget package Xamarin.Android.Support.v7.AppCompat 25.4.0.2 still reference the Xamarin.Android.Support.Compat with the old version 25.4.0.2. So you will get that error.
To resolve this error, you should update all default package at once instead of one of them.
I'm using minGW with NetBeans to programming in C++. I know that I should use VS but it's defined to use NB.
Now I need to make unit tests. I tried to use cppUnit but I just can´t install it correctly. I tried to follow several tutorials and nothing.
From commands errors to NetBeans errors.
I have minGW installed with Msys.
I tried to use cppUnit but I just can´t install it correctly.
You can't install CppUnit out of the box, you have to build it before.
Steps to do
Get the sourcecode
Build it
Install (depends on how you handle your probjects)
Add to your project
Get the sourcecode
You can get the sources from the CppUnit website at freedesktop.org.
Either clone the git repository or download the release version.
Build it
The build is done using configure and make:
cd cppunit
./autogen.sh
./configure
make
make install
Do not use the windows cmd for that, this may fail - use sh instead (eg. open a cmd and execute sh to get a mingw shell).
Install
For installation on windows see INSTALL-WIN32.txt file within cppunit.
Add to your project
You have to add the compiled binaries to the linker- and header paths to compiler flags. This strongly depends on how you build your project (= the one with your unit tests).
Since your question is tagged with netbeans, there's something realy cool:
You can add cppunit only as testing dependency. For a default NetBeans C/C++ this is done through a right click on "Test Files" -> Properties" -> "C(++) Compiler respectively Linker settings.
Unit tests can be added manually or through the "New File" Dialog.