We have a solution that relies on Castle Windsor with some projects referencing 3.0 and some 3.1.
The tests need Windsor 3.1, but the final project to be built references 3.0, which means that it the last version copied into the OutDir folder. This results in all our tests failing in MSTest but not locally.
Is there any way to force the tests to run using the 3.1 versions or will we need to update all projects in the solution?
Related
I am currently running .NET 5.0 and VS Version 16.8.0 (but this was an issue on previous versions). I need to write unit tests for my RouteConfig file and I need to create a RouteCollection in my test.
I have a .NET Core 2.0 MVC web application that I am trying to get deployed properly through VSTS CI/CD Build and Release definitions. I understand that, by default, .NET Core 2.0 sets Razor View Precompilation to true, in order to precompile all of the Views into a DLL when publishing the application. When I build and publish locally through Visual Studio 2017, everything works fine. When I try to build and release to a web server through VSTS, though, the precompiled DLL for views is not being updated / copied to server.
Is there any solution or fix for this yet? I am seeing a lot of discussion about it online with some workarounds, but many of the posts I am seeing are about a year old or more. So I am wondering if anyone has figured this out yet?
The rest of my MVC deployment seems to be working fine. It is just the precompiled DLL for the Views is not being included in the release and therefore not being copied/overwritten on the server.
Refer to these steps below:
Create a new build definition
Choose ASP.NET Core build template
Modify tasks if needed
Then the necessary files are in the artifact folder (xxx\a).
We have more than 100 projects (in 1.1, 2.0 .net framework) which needs to be upgraded to 4.0/4.5 .net framework.
When we change the target framework of any project from 2.0 to 4.0, then the visual studio upgrades the .*proj and .config file. But no changes are made to any code file.
I want to create a re-usable utility which can be used to scan the source code files for a set of pre-defined features (ex, some old controls, obsolete classes etc); and then update the code files with its compatible feature/version in newer .net framework.
Any ideas?
I will try to explain this as clear as I can
I want to fully understand how MSBuild multitargeting works.
I have read several articles from Microsoft and I think I understand the basic but I want to be sure I am not missing anything.
According to Microsoft:
By using Visual Studio, you can compile an application to run on any one of several versions of the .NET Framework. For example, you can compile an application to run on the .NET Framework version 2.0, and compile the same application to run on the .NET Framework version 4. The ability to compile to more than one framework is named multitargeting.
Visual Studio runs under the most current version of the .NET Framework that is installed on the development computer.
http://msdn.microsoft.com/en-us/library/ee395432.aspx
So do this mean that Visual Studio always calls MSBuild from the latest framework installed? assuming Visual Studio 2010 is installed, it will always call: %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe when building any project targettting any .Net Framework version right???
If yes, then the ability to target old .Net Framewrok versions is based on the ToolsVersion and/or TargetFrameworkVersion properties right???
If yes again, it would mean that just installing the latest framework (and also the older frameworks but not installing visual studio) in my Continuous Integration box, I could point to build always any solution to: %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe and just specify the ToolsVersion argument (if required, since each project can have its own target version specified in the TargetFrameworkVersion which it would cause to target an older .Net Framework version).
Following this I think my CI box would be building like Visual Studio does. Am I right? What am I missing? Is there a way to be completely sure?
I did a quick test, and I think it works :p the projects are being built according to the .Net Framework specified but like I said I want to be sure I am not missing anything.
Any thoughts?
BTW:
The simple reason to want to do that is because I have several custom MSBuild scripts that are reusable accross projects, but some of the functionality in these scripts require MSBuild 4.0 and also I have several MSBuild tasks built on top of the framework 4.0 so if I have for example a solution targetting the Framework 2.0 and I try to build it using: %WINDIR%\Microsoft.NET\Framework\v2.0.50727\MsBuild.exe I get MSBuild errors trying to load my custom targets
Yes, you've got it mostly correct. Calling MSBuild from the 4.0 directory will do the correct thing against previous versions. They only thing I wanted to add was that 3.5 must be on the box to actually build projects targeting 2.0, 3.0 and 3.5.
This page here: http://msdn.microsoft.com/en-us/library/bb822049.aspx calls out the what versions Windows comes with what version of the framework pre-installed.
I have just upgraded a solution with two web deployment projects from VS 2008 to 2010 (upgrading all the projects to .net 4.0 as I went).
I installed the new VS2010 web deployment projects to allow me to open my old build projects (these build up my web sites, clean up a few files and zip them for upload).
I've got these working again, but when I look at the built files, all the referenced .net framework files (e.g. System.Web.dll etc) have been included in the deployed site. Does anybody know why this might be happening and how to turn it off?
Maybe you are using a component (DLL) which is using that files probably by needing specific file version of some framework libraries. VS will automatically copy dependencies of a dependency.
It seems you're using .Net framework Client profile version. Please check the .Net framework version selected for upgraded projects under Project properties.
Here is the MSDN article on .Net framework client profile:
http://msdn.microsoft.com/en-us/library/cc656912.aspx
One reason could be the Copy Local = True property of the referenced .net framework files.