Fix for #3528518, this allows (tested with .net 4.0) to load plugins from "remote" locations without getting CAS issues. I expect that with .NET 2.0 it's still not possible to do so, but that's not really a huge issue...

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1959 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-07-20 11:09:30 +00:00
commit c820d3edce
3 changed files with 91 additions and 3 deletions

View file

@ -4,4 +4,7 @@
<supportedRuntime version="v4.0" sku="client"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectGuid>{CD642BF4-D815-4D67-A0B5-C69F0B8231AF}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -17,6 +17,26 @@
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<ApplicationManifest>greenshot.manifest</ApplicationManifest>
<TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
@ -43,13 +63,36 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>1857EB0CBA9FA06B97305F97D3A093F4B31699B0</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Greenshot_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Greenshot_TemporaryKey.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>Lib\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
@ -179,6 +222,12 @@
<Compile Include="Forms\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\MySaveDialog.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\MySaveDialog.Designer.cs">
<DependentUpon>MySaveDialog.cs</DependentUpon>
</Compile>
<Compile Include="Forms\PrintOptionsDialog.cs">
<SubType>Form</SubType>
</Compile>
@ -207,7 +256,10 @@
<Compile Include="Forms\MovableShowColorForm.Designer.cs">
<DependentUpon>MovableShowColorForm.cs</DependentUpon>
</Compile>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="Greenshot_TemporaryKey.pfx" />
<None Include="Helpers\AviHelper.cs" />
<Compile Include="Helpers\CaptureHelper.cs" />
<Compile Include="Helpers\ClipboardHelper.cs" />
@ -222,6 +274,7 @@
<Compile Include="Processors\TitleFixProcessor.cs" />
<None Include="Greenshot.exe.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<Compile Include="Helpers\WindowWrapper.cs" />
<Compile Include="Memento\AddElementMemento.cs" />
@ -245,6 +298,9 @@
<Compile Include="Helpers\StartupHelper.cs" />
<Compile Include="Helpers\ToolStripItemEndisabler.cs" />
<Compile Include="GreenshotMain.cs" />
<EmbeddedResource Include="Forms\AboutForm.resx">
<DependentUpon>AboutForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ColorDialog.resx">
<DependentUpon>ColorDialog.cs</DependentUpon>
</EmbeddedResource>
@ -254,6 +310,12 @@
<EmbeddedResource Include="Forms\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\MySaveDialog.resx">
<DependentUpon>MySaveDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\QualityDialog.resx">
<DependentUpon>QualityDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
@ -310,6 +372,7 @@
</None>
<EmbeddedResource Include="Languages\language-en-US.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="Languages\language-es-ES.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@ -411,6 +474,28 @@
<Name>GreenshotPlugin</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PreBuildEvent>"$(MSBuildProjectDirectory)\tools\TortoiseSVN\SubWCRev.exe" "$(MSBuildProjectDirectory)\." "$(MSBuildProjectDirectory)\AssemblyInfo.cs.template" "$(MSBuildProjectDirectory)\AssemblyInfo.cs"

View file

@ -229,7 +229,7 @@ namespace Greenshot.Helpers {
foreach (string pluginFile in pluginFiles) {
LOG.DebugFormat("Checking the following file for plugins: {0}", pluginFile);
try {
Assembly assembly = Assembly.LoadFrom(pluginFile, Assembly.GetExecutingAssembly().Evidence);
Assembly assembly = Assembly.LoadFrom(pluginFile);
PluginAttribute[] pluginAttributes = assembly.GetCustomAttributes(typeof(PluginAttribute), false) as PluginAttribute[];
if (pluginAttributes.Length > 0) {
PluginAttribute pluginAttribute = pluginAttributes[0];