简体   繁体   中英

Postsharp problems on teamcity

We have a project trageting .net framework 4.0 and we are using postsharp. everything is working fine on my local machine but on our teamcity server we get the following error

00:44][MSBuild output] "C:\TeamCity\buildAgent\work\a26b6bf43590f451\Main\myproj.csproj" (default target) (4:2) ->
[16:00:44][MSBuild output] (PostSharp30 target) -> 
[16:00:44][MSBuild output]   unknown : error PS0219: The targeting pack for target platform ".NETFramework,Version=v4.0" is either not installed or not properly registered. Please install the appropriate targeting pack. [C:\TeamCity\buildAgent\work\a26b6bf43590f451\Main\myproj.csproj]
[16:00:44][MSBuild output] 
[16:00:44][MSBuild output]     2 Warning(s)
[16:00:44][MSBuild output]     1 Error(s)
[16:00:44][MSBuild output] 
[16:00:44][MSBuild output] Time Elapsed 00:00:30.78

The error you are getting suggests that there is some problem with registration of .NET SDK's to MSBuild. PostSharp uses MSBuild calls to determine installed frameworks and fetch information about these. You can inspect what PostSharp "sees" by looking into C:\\ProgramData\\PostSharp\\InstalledFrameworks directory and on the latest XML file in there.

To solve this, please install Microsoft Build Tools 2013 on the build server. Then, while configuring a build step in TeamCity, please make sure that you have Microsoft Build Tools 2013 and MSBuild 12.0 selected. MSBuild from .NET 4.5 (Visual Studio 2012) will also work.

This isn't really a PostSharp error — your build agent probably just doesn't have the correct version of Visual Studio installed. You can either install VS, or manually install the appropriate targeting pack on your build agents. (That link is for VS2013. See the other links on that page if you're using other versions of VS.)

It may help to know that "targeting packs" in this context are also known as ".NET SDKs."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM