1
從Download - Samples – PostSharp 下載樣本後,顯示「需要PostSharp」對話框,要求安裝PostSharp 2.1。如何將PostShard樣本從2.1運行到4.1?
我在我的機器上安裝了PostSharp 4.1,有沒有辦法使用PostSharp 4.1來運行這些示例?
從Download - Samples – PostSharp 下載樣本後,顯示「需要PostSharp」對話框,要求安裝PostSharp 2.1。如何將PostShard樣本從2.1運行到4.1?
我在我的機器上安裝了PostSharp 4.1,有沒有辦法使用PostSharp 4.1來運行這些示例?
大多數樣品應該兼容,但目前尚未正式支持。
將它們轉換爲新的PostSharp版本,你需要編輯的csproj文件中刪除以下XML:
<!-- The next section automatically prompts you to install PostSharp if needed. It is not required in normal projects. -->
<UsingTask AssemblyFile="lib\PostSharp.MSBuild.Samples.exe" TaskName="PostSharp.MSBuild.Samples.LaunchPostSharpInstaller" />
<Target Name="PostSharp21Check" Condition="'$(PostSharp21Imported)'==''" >
<LaunchPostSharpInstaller ProjectPath="$(MSBuildProjectFullPath)" Version="2.1" ProjectGuid="$(ProjectGuid)" BuildingProject="$(BuildingProject)" />
<Error Text="To build this project, you must install PostSharp 2.1 on your machine or add it as a NuGet package to this project." />
</Target>
<PropertyGroup >
<ResolveReferencesDependsOn>PostSharp21Check;$(ResolveReferencesDependsOn)</ResolveReferencesDependsOn>
</PropertyGroup>
此外,你需要刪除所有引用PostSharp組件 - 最有可能只PostSharp.dll(在編輯csproj文件或重新打開後)。
重新打開項目後,您應該添加PostSharp NuGet包,它將安裝當前版本的PostSharp。
感謝您的快速響應! –