Due to a bug in the Roslyn compiler, I cannot build my project using v1.0 of the compiler (there is no workaround to make it work on 1.0). However, Microsoft has corrected the issue in a more recent version of the compiler.
When using Visual Studio, you can use a specific version of the compiler by adding the NuGet package available from https://www.nuget.org/packages/Microsoft.Net.Compilers/ to your project. This causes Visual Studio to use the specified version of the compiler when building the project.
However, when attempting to run a build on TeamCity, it does not seem to know to use the new version of the compiler. It only allows one to choose which version of Visual Studio to use. Is there any way to specify to TeamCity which version of the compiler to use manually?
Note: I am using TeamCity Professional 9.1.3 (build 37176) and in the build step I have chosen Visual Studio 2015.
When built locally, the build is done using:
D:\BitBucket\LocalPackages\Microsoft.Net.Compilers.1.1.0-beta1-20150928-02\build\..\tools\csc.exe /noconfig /nowarn:1701,1702,2008 ....
But when built on TeamCity, the log shows:
[Csc] C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702 .....
I have also confirmed that the package is installed as part of the TeamCity build (prior to the csc command):
[Exec] Installing 'Microsoft.Net.Compilers 1.1.0-beta1-20150928-02'.
Is this just a symptom of how NuGet can behave differently in the Visual Studio UI vs. Command line? And if so, is there a workaround?
Update:
I never did figure it out. Running the build in Visual Studio on the build server worked perfectly, but running the build using the exact same files through TeamCity did not work.
However, Microsoft released VS2015 Update 1, which resolves my original issue, though not this specific problem.
The Microsoft.Net.Compilers package is using the standard Nuget tooling. Specifically, there is a build folder in the package, which contains a props file. This props file gets injected into the csproj file, and is responsible for changing the csc executable to the one in the package.
If you are using msbuild 14, then the .props file is changing the CscToolPath, and the CscToolExe to point to the csc.exe in the package. So you just have to make sure that TeamCity is using msbuild 14.
Which version of TeamCity are you using? The documentation of 9.1 says that it supports msbuild 14 (msbuild 2015). If you are on older version, you could still use msbuild 14 from the command line runner.
Related
I have a TeamCity hosted Nuget package repository. I see the package in the repo xml, http://teamcity.mycompany.com:8080/httpAuth/app/nuget/v1/FeedService.svc/Packages(Id='MyCompany.MyPackage',Version='1.0.21')
But when I look to reference the package in my visual studio project, it still says the previous version is the latest one. I attempt to click refresh, doesn't show the latest version. I confirmed the 1.0.21 is listed as absolute latest version by going directly to the package and checking the xml.
I have attempted to use the report a problem in the upper right of the IDE, but it's unresponsive. hopefully someone from Microsoft sees this.
How can I install nuget packages for my PowerShell Projects in Visual Studio 2015? I have tried to do it with both the PowerShell Module Project and PowerShell Script Project. I have installed PowerShell Tools for Visual Studio 2015.
When I open these projects, the Default project in the Package Manager Console is empty. Here is a screenshot of what I mean.
When I try to install a nuget package, e.g. Pester, I get the following error.
I know this thread might be outdated and is rather old but my older article with some possible solutions might help here. I tested current state and still, no support inside VS 2015 for PowerShell project and NuGet packages together.
the current state is :
go with https://chocolatey.org/ and install it on your dev box (and CI) => you install pester globally with : choco install pester and update it if needed.
use old packages.config and update by hand version number and run nuget restore (nuget update will no longer work for this type of solution).
version whole pester into repo and call it directly. you can use nuget install pester for this (if you have nuget in path somewhere)
The link : http://rostacik.net/2015/12/16/how-to-use-nuget-packages-even-with-powershell-projects-with-visual-studio-2015/
I installed the Visual Studio 2015 yesterday on my work machine and map a project from TFS that i was working on the previous version (VS 2013). All the projects in this solution are build on top of .NET framework 4.5.1 . When i try to make a Restore Nuget Packages it says that all the packages in the packages.config files are downloaded already, but im getting a lot of compilation errors. The Microsoft.Exchange.WebServices.Data; reference for example, its declared on the packages.config file but im getting the 'red' error on the using clause of this reference in visual studio.
ThereĀ“s other package that the nuget says it is installed but in the references its possible to see an yellow triangle. And this package is on the packages.config too.
Is that something different in this new versio of nuget?
Ps. I already installed the update of the nuget program.
I think I'm missing something here. I installed Tesdriven and then Gallio (third link from top - Gallio 3.5 x64 installer)
Then I installed the mbunit dlls from Nuget because I didn't want to include a dll from my hard drive as it makes it difficult for the project to be ported to other machines..
However, when I try to run a sample test, testrunner insists that I reference the dlls from my hard disk.. the actual error message is this:
It looks like you're trying to execute a Gallio/MbUnit unit test.
For Gallio v3.0.6 build 787 / Gallio v3.1 build 313 or above (recommended):
Please ensure that the directory containing your 'MbUnit.dll' reference also contains Gallio's
test runner files ('MbUnit.dll.tdnet', 'TDNet\Gallio.TDNetRunner.dll', 'Gallio.dll' etc.)
For earlier versions:
You need to install Gallio (after TestDriven.Net) using its MSI installer.
You can find Gallio downloads and support here:
http://www.gallio.org/
So, is there a way to get testrunner to run the tests with just nuget packages, please?
Currently nuget gallery has only 3.3.1 version of mbunit package, and you installed Gallio v3.4. It's very annoying limitation of gallio and mbunit. In order to use nuget package you have to downgrade Gallio on your machine to v3.3.1. Better solution it's mail to gallio/mbunit team and ask to upload nuget package with latest release or make it by yourself.
I recently installed Visual Studio on a new computer and as a result I now have Nuget 1.5.2. This version doesn't seem to work with my old solution. When I add a new project and try adding references via Nuget, it says they are already installed and does nothing, even though that reference doesn't exist in the new project.
Does anyone know why this might be happening or alternatively where I can download the old Nuget (1.4.2)?
Thanks!
The NuGet Command Line is available as a NuGet package.
Just like with any other NuGet package, you can get a specific version by using the -Version switch in the Package Manager Console.
To get v1.4.2 of the NuGet command line tool, you should execute the following PowerShell script from the Package Manager Console:
Install-Package Nuget.CommandLine -Version 1.4.20615.182