问题
I have customized the Enterprise Library and now want to rebuild it, but I get some errors when executing the BuildLibrary.bat (Scripts folder) from Developer Command Prompt for VS2015.
Environment:
- Win 8
- VS2015
Two issues:
1.)
Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft. Build.Tasks.v12.0.dll
On my system I have a newer version:
Microsoft.Build.Tasks.v4.0.dll
2.)
"C:\EntLib6Source\Blocks\EnterpriseLibrary.sln" (Rebuild target) (1) -> "C:\EntLib6Source\Blocks\SemanticLogging\Src\SemanticLogging.Database\SemanticLogging.Database.csproj" (Rebuild target) (53) -> "C:\EntLib6Source\Blocks\TransientFaultHandling\Source\TransientFaultHandling\TransientFaultHandling.csproj" (Clean target) (35:11) -> C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(283,22): error MSB4086: A numeric comparison was attempt ed on "10.0.11000.0" that evaluates to "10.0.11000.0" instead of a number, in condition "'$(TargetPlatformVersion)' >= '10.0.11000.0'". [C:\EntLib6Source\Blocks \TransientFaultHandling\Source\TransientFaultHandling\TransientFaultHandling.csproj]
"C:\EntLib6Source\Blocks\EnterpriseLibrary.sln" (Rebuild target) (1) -> "C:\EntLib6Source\Blocks\SemanticLogging\Src\SemanticLogging\SemanticLogging.csproj" (Rebuild target) (52) -> (CheckPrerequisites target) ->
C:\EntLib6Source\Blocks.nuget\nuget.targets(71,9): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Windows\Micros oft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v12.0.dll". Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft. Build.Tasks.v12.0.dll' or one of its dependencies. The system cannot find the file specified. [C:\EntLib6Source\Blocks\SemanticLogging\Src\SemanticLogging\Seman ticLogging.csproj]
回答1:
Ok I solved it by overriding the toolsversion. Didn't use the BuildLibrary.bat.
Executed msbuild directly with the following switches:
msbuild.exe EnterpriseLibrary.sln /tv:14.0 /p:Configuration=Debug
If you want the Release version, replace debug with release.
P.S.: What I also did, was upgrading all projects to use .NET 4.6.1. But I think, overriding the tv is enough.
来源:https://stackoverflow.com/questions/39546020/how-to-rebuild-enterprise-library-6-on-win-8-and-vs2015