Permalink
Browse files

Added test data for msbuild test

  • Loading branch information...
1 parent a6fc484 commit d5307ea8172cee7db7fd8f001e7f7fccfc20507a @einaregilsson committed Jan 12, 2012
Showing with 44 additions and 8 deletions.
  1. +6 −1 InjectModuleInitializer.csproj
  2. +2 −2 InjectModuleInitializer.sln
  3. +1 −5 Injector.cs
  4. +23 −0 TestData/test.build
  5. +12 −0 TestData/test.cs
@@ -85,6 +85,9 @@
<Compile Include="Injector.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Content Include="TestData\test.cs">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Compile Include="TestRunner.cs" />
<Compile Include="UnitTests.cs" />
</ItemGroup>
@@ -112,7 +115,9 @@
<Content Include="lib\nunit.framework.dll" />
</ItemGroup>
<ItemGroup>
- <None Include="EinarEgilssonStrongName.snk" />
+ <None Include="TestData\test.build">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -9,8 +9,8 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8B2B6640-191B-4733-8243-5A4270162F86}.Debug|Any CPU.ActiveCfg = Release|Any CPU
- {8B2B6640-191B-4733-8243-5A4270162F86}.Debug|Any CPU.Build.0 = Release|Any CPU
+ {8B2B6640-191B-4733-8243-5A4270162F86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8B2B6640-191B-4733-8243-5A4270162F86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B2B6640-191B-4733-8243-5A4270162F86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B2B6640-191B-4733-8243-5A4270162F86}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
View
@@ -88,7 +88,6 @@ public bool Execute()
LogError(Errors.AssemblyDoesNotExist(AssemblyFile));
return false;
}
-
ReadAssembly();
MethodReference callee = GetCalleeMethod();
@@ -105,10 +104,7 @@ public bool Execute()
}
catch (Exception ex)
{
- if (LogError != null)
- {
- LogError(ex.Message);
- }
+ LogError(ex.Message);
return false;
}
}
View
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <UsingTask TaskName="InjectModuleInitializer" AssemblyFile="..\InjectModuleInitializer.exe" />
+ <PropertyGroup>
+ <AssemblyName>TestOut</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <StartupObject>Test</StartupObject>
+ <OutputPath>.</OutputPath>
+ <AssemblyOriginatorKeyFile Condition="Exists('$(PrivateKeys)\EinarEgilssonStrongName.snk')">$(PrivateKeys)\EinarEgilssonStrongName.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Test.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Target Name="AfterBuild">
+ <Message Text="HI $(TargetPath)"/>
+ <InjectModuleInitializer AssemblyFile="$(TargetPath)" />
+ </Target>
+</Project>
View
@@ -0,0 +1,12 @@
+class Test {
+
+ public static void Main(){
+ System.Console.Write("<Main>");
+ }
+}
+
+public class ModuleInitializer {
+ public static void Run() {
+ System.Console.WriteLine("<Init>");
+ }
+}

0 comments on commit d5307ea

Please sign in to comment.