Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
570 views
in Technique[技术] by (71.8m points)

.net - ASPNETCOMPILER error ASPCONFIG: Could not load file or assembly 'Microsoft.VisualBasic.Activities.Compiler' or one of its dependencies

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:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler.exe -v /Website -p Website -u -f PrecompiledWebWebsite
[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 FilesTeamCityuildAgentwork8bbb8fc03bd91944Dependencieswnvxls.dll" to "Website\Binwnvxls.dll".
[12:11:50]: Copying file from "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944Dependencieswnvxls.xml" to "Website\Binwnvxls.xml".
[12:11:50]: C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler.exe -v /Website -p Website -u -f PrecompiledWebWebsite
[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 FilesTeamCityuildAgentwork8bbb8fc03bd91944Website.metaproj]
[12:11:50]: Done Building Project "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944Website.metaproj" (Rebuild target(s)) -- FAILED.
[12:11:50]: Done Building Project "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.sln" (Rebuild target(s)) -- FAILED.
[12:11:50]: Done Building Project "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build;TeamCity_Generated_NUnitTests target(s)) -- FAILED.
[12:11:50]: Build FAILED.
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build;TeamCity_Generated_NUnitTests target) (1) ->
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.sln" (Rebuild target) (2) ->
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944Website.metaproj" (Rebuild target) (3) ->
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.OtherMyProject.Other.csproj" (Rebuild target) (5) ->
[12:11:50]: (CoreCompile target) ->
[12:11:50]: HelpersProgramHelper.cs(40,21): warning CS0168: The variable 'ex' is declared but never used [C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.OtherMyProject.Other.csproj]
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.sln.teamcity.patch.tcprojx" (TeamCity_Generated_Build;TeamCity_Generated_NUnitTests target) (1) ->
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944MyProject.sln" (Rebuild target) (2) ->
[12:11:50]: "C:Program FilesTeamCityuildAgentwork8bbb8fc03bd91944Website.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 FilesTeamCityuildAgentwork8bbb8fc03bd91944Website.metaproj]
[12:11:50]: 1 Warning(s)
[12:11:50]: 1 Error(s)
[12:11:50]: Time Elapsed 00:00:31.48

I tried copying the .net framework reference assemblies to C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0 thinking that would fix things, but still no luck. Any thoughts?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For me it was indeed an x86/x64 mismatch. I solved it by specifying the path to the x64 MSBuild through the MSBuild environment variable:

Set the MSBuild environment variable


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...