问题描述
我只是我的项目升级到Asp.Net 4,从3.5。当构建从TeamCity的序幕,我得到以下错误:
I just upgraded my project to Asp.Net 4, from 3.5. When the build kicks off from TeamCity, I get the following error:
[Project "Website.metaproj" (Rebuild target(s)):] C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /Website -p Website\ -u -f PrecompiledWeb\Website\
[12:11:50]: [Project "Website.metaproj" (Rebuild target(s)):] ASPNETCOMPILER error ASPCONFIG: Could not load file or assembly 'Microsoft.VisualBasic.Activities.Compiler' or one of its dependencies. An attempt was made to load a program with an incorrect format.
[12:11:50]: MSBuild output:
[12:11:50]: Copying file from "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Dependencies\wnvxls.dll" to "Website\\Bin\wnvxls.dll".
[12:11:50]: Copying file from "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Dependencies\wnvxls.xml" to "Website\\Bin\wnvxls.xml".
[12:11:50]: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /Website -p Website\ -u -f PrecompiledWeb\Website\
[12:11:50]: ASPNETCOMPILER : error ASPCONFIG: Could not load file or assembly 'Microsoft.VisualBasic.Activities.Compiler' or one of its dependencies. An attempt was made to load a program with an incorrect format. [C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Website.metaproj]
[12:11:50]: Done Building Project "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Website.metaproj" (Rebuild target(s)) -- FAILED.
[12:11:50]: Done Building Project "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.sln" (Rebuild target(s)) -- FAILED.
[12:11:50]: Done Building Project "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build;TeamCity_Generated_NUnitTests target(s)) -- FAILED.
[12:11:50]: Build FAILED.
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build;TeamCity_Generated_NUnitTests target) (1) ->
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.sln" (Rebuild target) (2) ->
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Website.metaproj" (Rebuild target) (3) ->
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.Other\MyProject.Other.csproj" (Rebuild target) (5) ->
[12:11:50]: (CoreCompile target) ->
[12:11:50]: Helpers\ProgramHelper.cs(40,21): warning CS0168: The variable 'ex' is declared but never used [C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.Other\MyProject.Other.csproj]
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build;TeamCity_Generated_NUnitTests target) (1) ->
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\MyProject.sln" (Rebuild target) (2) ->
[12:11:50]: "C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Website.metaproj" (Rebuild target) (3) ->
[12:11:50]: (Rebuild target) ->
[12:11:50]: ASPNETCOMPILER : error ASPCONFIG: Could not load file or assembly 'Microsoft.VisualBasic.Activities.Compiler' or one of its dependencies. An attempt was made to load a program with an incorrect format. [C:\Program Files\TeamCity\buildAgent\work\8bbb8fc03bd91944\Website.metaproj]
[12:11:50]: 1 Warning(s)
[12:11:50]: 1 Error(s)
[12:11:50]: Time Elapsed 00:00:31.48
我试图复制在.NET Framework引用程序集到C:\ Program Files文件(x86)的\参考大会\微软\ Framework.NETFramework \ V4.0以为会解决的事情,但仍没有运气。有什么想法?
I tried copying the .net framework reference assemblies to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0 thinking that would fix things, but still no luck. Any thoughts?
推荐答案
此错误不得不与溶液中的类库引用旧的(V3或V3.5)的系统组件。这些类库是由我的网站引用,所以系统组件得到复制到bin文件夹一起类库。也许在3.5目录下的系统组件都高于4.0目录不同的权限,而当aspnet_compiler试图从bin目录加载它们,它barfed。
This error had to do with class libraries in the solution referencing older (v3 or v3.5) system assemblies. Those class libraries were referenced by my website, so the system assemblies got copied to the bin folder along with the class libraries. Maybe the system assemblies in the 3.5 directory have different permissions than the 4.0 directory and when the aspnet_compiler tried to load them from the bin directory, it barfed.
在经历每次的csproj文件和更新< RequiredTargetFramework>
值 4.0
,一切工作正常
After going through each csproj file and updating <RequiredTargetFramework>
values to 4.0
, everything is working as expected.
这篇关于ASPNETCOMPILER错误ASPCONFIG:无法加载文件或程序集“Microsoft.VisualBasic.Activities.Compiler”或它的某一个依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!