Skip to content

Commit 1758df5

Browse files
committed
added msbuild targets
1 parent 796d98c commit 1758df5

3 files changed

Lines changed: 150 additions & 6 deletions

File tree

Dnn.WebAnalytics.csproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
<DebugSymbols>true</DebugSymbols>
3030
<DebugType>full</DebugType>
3131
<Optimize>false</Optimize>
32-
<OutputPath>..\..\bin\</OutputPath>
32+
<OutputPath>bin\</OutputPath>
3333
<DefineConstants>DEBUG;TRACE</DefineConstants>
3434
<ErrorReport>prompt</ErrorReport>
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
3737
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3838
<DebugType>pdbonly</DebugType>
3939
<Optimize>true</Optimize>
40-
<OutputPath>..\..\..\bin\</OutputPath>
40+
<OutputPath>bin\</OutputPath>
4141
<DefineConstants>TRACE</DefineConstants>
4242
<ErrorReport>prompt</ErrorReport>
4343
<WarningLevel>4</WarningLevel>
@@ -74,6 +74,7 @@
7474
<Reference Include="Microsoft.CSharp" />
7575
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
7676
<HintPath>packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
77+
<Private>False</Private>
7778
</Reference>
7879
<Reference Include="System" />
7980
<Reference Include="System.configuration" />
@@ -89,6 +90,7 @@
8990
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9091
<SpecificVersion>False</SpecificVersion>
9192
<HintPath>..\..\bin\System.Web.Http.dll</HintPath>
93+
<Private>False</Private>
9294
</Reference>
9395
<Reference Include="System.XML" />
9496
<Reference Include="System.Xml.Linq" />
@@ -148,6 +150,7 @@
148150
<Content Include="plugins\angular-chart\angular-chart.min.js" />
149151
<Content Include="Scripts\01.01.01.sql" />
150152
<Content Include="Scripts\01.01.00.sql" />
153+
<Content Include="Scripts\Uninstall.sql" />
151154
<Content Include="View.ascx" />
152155
<Content Include="plugins\angular-toastr\angular-toastr.min.css" />
153156
<Content Include="plugins\angular-toastr\angular-toastr.tpls.min.js" />
@@ -159,9 +162,6 @@
159162
<Content Include="plugins\ui.bootstrap\ui-bootstrap-tpls.js" />
160163
<Content Include="Scripts\01.00.00.sql" />
161164
</ItemGroup>
162-
<ItemGroup>
163-
<Content Include="Dnn.WebAnalytics.config" />
164-
</ItemGroup>
165165
<ItemGroup>
166166
<Content Include="DAL\WebAnalytics.dbml">
167167
<Generator>MSLinqToSQLGenerator</Generator>
@@ -171,8 +171,9 @@
171171
<None Include="DAL\WebAnalytics.dbml.layout">
172172
<DependentUpon>WebAnalytics.dbml</DependentUpon>
173173
</None>
174-
<Content Include="Dnn.VisitorsOnline.dnn" />
175174
<Content Include="Dnn.WebAnalytics.dnn" />
175+
<Content Include="msbuild\BuildProperties.targets" />
176+
<Content Include="msbuild\Project.targets" />
176177
<None Include="packages.config" />
177178
<Content Include="plugins\angular-chart\angular-chart.min.js.map" />
178179
</ItemGroup>
@@ -181,6 +182,7 @@
181182
</ItemGroup>
182183
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
183184
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" />
185+
<Import Project="$(MSBuildProjectDirectory)\MSBuild\Project.targets" />
184186
<ProjectExtensions>
185187
<VisualStudio>
186188
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">

msbuild/BuildProperties.targets

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<CompanyName>DnnCommunity</CompanyName>
5+
<ModuleName>Dnn.WebAnalytics</ModuleName>
6+
<InstallDir>_Installation</InstallDir>
7+
<svn></svn>
8+
<BinDir>$(MSBuildProjectDirectory)\bin</BinDir>
9+
<DotNetNukeDir>$(MSBuildProjectDirectory)\..\..</DotNetNukeDir>
10+
<!-- DNN requires single digits to be prefixed with a zero -->
11+
<Major>01</Major>
12+
<Minor>01</Minor>
13+
<Build>02</Build>
14+
<Revision>00</Revision>
15+
</PropertyGroup>
16+
</Project>
17+
18+

msbuild/Project.targets

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<!-- PLEASE NOTE THAT CHANGES TO THIS FILE WILL NOT TAKE AFFECT UNTIL YOU UNLOAD AND RELOAD YOUR PROJECT! -->
4+
<!--
5+
requirements
6+
7+
MsBuildCommunityTasks: https://github.com/loresoft/msbuildtasks
8+
9+
modifiations to project file:
10+
11+
<Import Project="$(MSBuildProjectDirectory)\MSBuild\Project.targets" />
12+
13+
-->
14+
<Import Project="$(MSBuildProjectDirectory)\msbuild\BuildProperties.Targets"/>
15+
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" Condition="Exists('$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets')"/>
16+
17+
<ItemGroup>
18+
<AssemblyInfoFile Include="$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs" />
19+
<dnnFile Include="$(MSBuildProjectDirectory)\$(MSBuildProjectName).dnn" />
20+
</ItemGroup>
21+
22+
<Target Name="BeforeBuild" Condition="'$(ConfigurationName)'=='Release'">
23+
<CallTarget Targets="SetVersionInfo" />
24+
</Target>
25+
<Target Name="AfterBuild">
26+
<CallTarget Targets="DeployFiles" />
27+
</Target>
28+
29+
<!-- Set the version numbers in DNN file and Assembly -->
30+
<Target Name="SetVersionInfo">
31+
<Message Text="MSBUILD: setting version from $(MSBuildProjectDirectory)\msbuild\BuildProperties.Targets: $(Major).$(Minor).$(Build).$(Revision)" Importance="high"></Message>
32+
33+
<!-- Write new version to assemblyinfo.cs -->
34+
<Message Text="MSBUILD: Updating @(AssemblyInfoFile) and @(dnnFile) with new version: $(Major).$(Minor).$(Build).$(Revision)" Importance="high"></Message>
35+
<FileUpdate Files="@(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyVersion(&quot;$(Major).$(Minor).$(Build).$(Revision)&quot;)" />
36+
<FileUpdate Files="@(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyFileVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyFileVersion(&quot;$(Major).$(Minor).$(Build).$(Revision)&quot;)" />
37+
<FileUpdate Files="@(dnnFile)" Regex="&quot;Module&quot; version=&quot;.*&quot;"
38+
ReplacementText="&quot;Module&quot; version=&quot;$(Major).$(Minor).$(Build)&quot;" />
39+
</Target>
40+
41+
<Target Name="DeployFiles">
42+
<MakeDir Directories="$(InstallDir)\" />
43+
44+
<CallTarget Targets="RemoveZips" Condition="'$(ConfigurationName)'=='Release'" />
45+
<CallTarget Targets="ZipInstall" Condition="'$(ConfigurationName)'=='Release'" />
46+
<CallTarget Targets="CopyFilesToDotNetNuke" Condition="'$(DotNetNukeDir)'!=''" />
47+
48+
</Target>
49+
50+
51+
<!-- remove files with same version number from installation dir -->
52+
<Target Name="RemoveZips" Condition="'$(ConfigurationName)'=='Release'">
53+
<Message Text="MSBUILD: removing old zips with version $(Major).$(Minor).$(Build) from $(InstallDir)\" Importance="high"></Message>
54+
<CreateItem Include="$(InstallDir)\$(CompanyName).$(ModuleName).$(Major).$(Minor).$(Build).Install.zip;">
55+
<Output TaskParameter="Include" ItemName="deleteFiles" />
56+
</CreateItem>
57+
<Delete ContinueOnError="true" Files="@(deleteFiles)"></Delete>
58+
</Target>
59+
60+
<!-- creat install zip file -->
61+
<Target Name="ZipInstall" Condition="'$(ConfigurationName)'=='Release'">
62+
<Message Text="MSBUILD: creating Installation Zip file: $(InstallDir)\$(CompanyName).$(ModuleName).$(Major).$(Minor).$(Build).$(Revision).Install.zip" Importance="high"></Message>
63+
<!-- delete resource zip to make it is not there -->
64+
<Delete Files="$(MSBuildProjectDirectory)\resources.zip"></Delete>
65+
66+
<!-- get files for resource zip-->
67+
<CreateItem Exclude="$(MSBuildProjectDirectory)\**\.git\**;
68+
$(MSBuildProjectDirectory)\$(InstallDir)\**;
69+
$(MSBuildProjectDirectory)\.vs\**;
70+
$(MSBuildProjectDirectory)\packages\**;
71+
$(MSBuildProjectDirectory)\_ReSharper**;
72+
$(MSBuildProjectDirectory)\**\obj\**;
73+
$(MSBuildProjectDirectory)\**\bin\**;
74+
$(MSBuildProjectDirectory)\**\Properties\**;
75+
$(MSBuildProjectDirectory)\*.dnn;
76+
$(MSBuildProjectDirectory)\*.md;
77+
$(MSBuildProjectDirectory)\**\msbuild\**"
78+
Include="$(MSBuildProjectDirectory)\**\*.ascx;
79+
$(MSBuildProjectDirectory)\**\*.aspx;
80+
$(MSBuildProjectDirectory)\**\*.html;
81+
$(MSBuildProjectDirectory)\**\*.cshtml;
82+
$(MSBuildProjectDirectory)\**\*.ashx;
83+
$(MSBuildProjectDirectory)\**\*.css;
84+
$(MSBuildProjectDirectory)\**\*.js;
85+
$(MSBuildProjectDirectory)\**\*.resx;
86+
$(MSBuildProjectDirectory)\**\*.rdlc;
87+
$(MSBuildProjectDirectory)\**\*.gif;
88+
$(MSBuildProjectDirectory)\**\*.jpg;
89+
$(MSBuildProjectDirectory)\**\*.png;">
90+
<Output TaskParameter="Include" ItemName="resources" />
91+
</CreateItem>
92+
93+
<!--get files for install zip-->
94+
<CreateItem
95+
Exclude="**.*"
96+
Include="$(BinDir)\Dnn.WebAnalytics.dll; $(BinDir)\FiftyOne*.dll; $(BinDir)\MaxMind.*.dll;
97+
$(MSBuildProjectDirectory)\resources.zip;
98+
$(MSBuildProjectDirectory)\**\*.Sql;
99+
$(MSBuildProjectDirectory)\*.dnn;">
100+
<Output TaskParameter="Include" ItemName="install"/>
101+
</CreateItem>
102+
103+
<!-- Create resources.zip -->
104+
<Zip Files="@(resources)" WorkingDirectory="$(MSBuildProjectDirectory)" ZipFileName="$(MSBuildProjectDirectory)\resources.zip" />
105+
106+
<!-- create install zip. file will contain folder structure -->
107+
<Zip Files="@(install)" WorkingDirectory="$(MSBuildProjectDirectory)"
108+
ZipFileName="$(InstallDir)\$(Major).$(Minor).$(Build)\$(CompanyName).$(ModuleName).$(Major).$(Minor).$(Build).$(Revision).Install.zip" />
109+
110+
<!-- cleanup -->
111+
<Delete Files="$(MSBuildProjectDirectory)\resources.zip"></Delete>
112+
</Target>
113+
<Target Name="CopyFilesToDotNetNuke">
114+
<!-- Copy assemblies and Debug Info to DNN Bin Dir -->
115+
<Message Text="MSBUILD: copying @(Assemblies) to $(DotNetNukeDir)\bin\" Importance="high"></Message>
116+
<CreateItem Include="$(BinDir)\*.pdb;$(BinDir)\*.dll;">
117+
<Output TaskParameter="Include" ItemName="Assemblies" />
118+
</CreateItem>
119+
<Copy SourceFiles="@(Assemblies)" DestinationFolder="$(DotNetNukeDir)\bin\" SkipUnchangedFiles="false" ContinueOnError="true" />
120+
<Message Text="MSBUILD: Copied @(Assemblies) to $(DotNetNukeDir)\bin\" Importance="high"></Message>
121+
</Target>
122+
</Project>
123+
124+

0 commit comments

Comments
 (0)