Red Gate forums :: View topic - SmartAssembly build failed. Type initializer threw exception
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

SmartAssembly build failed. Type initializer threw exception

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
KirillSk



Joined: 08 Oct 2012
Posts: 2

PostPosted: Mon Oct 08, 2012 7:41 am    Post subject: SmartAssembly build failed. Type initializer threw exception Reply with quote

Hi, I am using SmartAssembly 6.1 in my build tasks.
Here is fragment of my .csproj file.
Code:
<UsingTask TaskName="SmartAssembly.MSBuild.Tasks.Build" AssemblyName="SmartAssembly.MSBuild.Tasks, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7f465a1c156d4d57" />
  <Target Name="BeforeBuild">
    <CreateItem Include="$(ProjectDir)\**\*.*.resx">
      <Output TaskParameter="Include" ItemName="EmbeddedResource" />
    </CreateItem>
  </Target>
  <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' AND '$(Obfuscate)' == 'Yes' ">
    <SmartAssembly.MSBuild.Tasks.Build ProjectFile="CoreDomain.saproj" MarkAsReleased="True" />
  </Target>

I get following error when start building:
SmartAssembly build failed: The type initializer for 'SmartAssembly.ConsoleApp' threw an exception.
At the same time if I launch SmartAssembly application, create new project and build it, build succeeds. What could be wrong?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6669

PostPosted: Tue Oct 09, 2012 9:25 am    Post subject: Reply with quote

There is not enough information in the error message to say what the problem is, but off the top of me head I would say it was something to do with Log4Net. Because SA has to share its' process space with other add-ins, I've found some of them using different versions of the third-party log4net dll, and if an incompatible version gets loaded, it will cause a problem in the Visual Studio build.

The only way I've found around that is to not use the MSBUILD task DLL and change the post-build action to an EXEC task instead.
Back to top
View user's profile Send private message
KirillSk



Joined: 08 Oct 2012
Posts: 2

PostPosted: Tue Oct 09, 2012 11:05 am    Post subject: Re: Reply with quote

Brian Donahue wrote:
There is not enough information in the error message to say what the problem is, but off the top of me head I would say it was something to do with Log4Net. Because SA has to share its' process space with other add-ins, I've found some of them using different versions of the third-party log4net dll, and if an incompatible version gets loaded, it will cause a problem in the Visual Studio build.

The only way I've found around that is to not use the MSBUILD task DLL and change the post-build action to an EXEC task instead.

That works perfectly, thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group