Skip to content

Commit

Permalink
Added Costura.Fody to embed assemblies into executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ravibpatel committed Mar 12, 2018
1 parent 0591d34 commit 3a0f94a
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sales Manager/About.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private void buttonForum_Click(object sender, EventArgs e)
private void About_Load(object sender, EventArgs e)
{
labelName.Text = $@"{Application.ProductName} {Application.ProductVersion}";
labelCopyright.Text = $@"Copyright © 2017 {Application.CompanyName}";
labelCopyright.Text = $@"Copyright © 2017-{DateTime.Now.Year} {Application.CompanyName}";
}

private void richTextBoxCredits_LinkClicked(object sender, LinkClickedEventArgs e)
Expand Down
4 changes: 4 additions & 0 deletions Sales Manager/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura />
</Weavers>
2 changes: 1 addition & 1 deletion Sales Manager/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void FormMain_Shown(object sender, EventArgs e)
RefreshProductsComboBox();
if (Settings.Default.EnableUpdateNotification)
{
AutoUpdater.Start("http://rbsoft.org/updates/sales-manager.xml");
AutoUpdater.Start("https://rbsoft.org/updates/sales-manager.xml");
}
}

Expand Down
Binary file added Sales Manager/Help.chm
Binary file not shown.
15 changes: 15 additions & 0 deletions Sales Manager/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Sales Manager - Track your Envato market sales
RBSoft
http://rbsoft.org
http://rbsoft.uservoice.com
https://github.com/ravibpatel/SalesManager

MIT License

Copyright (c) 2017-2018 RBSoft

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 19 additions & 3 deletions Sales Manager/Sales Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@
<ApplicationIcon>Sales Manager.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Sales Manager.pfx</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>Sales Manager.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdater.NET, Version=1.4.7.0, Culture=neutral, PublicKeyToken=942f95247e354701, processorArchitecture=MSIL">
<HintPath>..\packages\Autoupdater.NET.Official.1.4.7\lib\net452\AutoUpdater.NET.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Data.Sqlite, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Sqlite.1.1.1\lib\net451\Microsoft.Data.Sqlite.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -239,7 +243,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Sales Manager.pfx" />
<None Include="Help.chm">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
Expand All @@ -252,6 +258,8 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Sales Manager.snk" />
<None Include="Setup\Sales Manager.nsi" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
Expand All @@ -269,6 +277,10 @@
</ItemGroup>
<ItemGroup>
<None Include="Resources\PayPal Donate.png" />
<None Include="FodyWeavers.xml" />
<Content Include="License.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Sales Manager.ico" />
<None Include="Resources\envato_market_api.png" />
<None Include="Resources\Sales Manager Icon.png" />
Expand All @@ -288,7 +300,11 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SQLite.3.13.0\build\net45\SQLite.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLite.3.13.0\build\net45\SQLite.props'))" />
<Error Condition="!Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.2.0.0\build\dotnet\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.2.0.0\build\dotnet\Fody.targets')" />
<Import Project="..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
Binary file added Sales Manager/Sales Manager.snk
Binary file not shown.
Binary file added Sales Manager/Sales Manager.snk.enc
Binary file not shown.
134 changes: 134 additions & 0 deletions Sales Manager/Setup/Sales Manager.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Sales Manager"
!define PRODUCT_VERSION "1.0.5"
VIProductVersion 1.0.5.0
!define PRODUCT_PUBLISHER "RBSoft Inc."
!define PRODUCT_WEB_SITE "http://www.rbsoft.org"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Sales Manager.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

VIAddVersionKey ProductName "${PRODUCT_NAME}"
VIAddVersionKey CompanyName "${PRODUCT_PUBLISHER}"
VIAddVersionKey LegalCopyright "Copyright © 2017-2018 RBSoft"
VIAddVersionKey FileVersion ${PRODUCT_VERSION}
VIAddVersionKey FileDescription "Sales Manager - Track your Envato market sales"
VIAddVersionKey ProductVersion ${PRODUCT_VERSION}
VIAddVersionKey InternalName "Sales Manager Setup"

SetCompressor lzma

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "DotNetChecker.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\nsis3-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\nsis3-uninstall.ico"
!define MUI_HEADERIMAGE_BITMAP "nsis3-metro-right.bmp"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "..\bin\Release\License.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\Sales Manager.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "..\..\Sales.Manager.Setup.exe"
InstallDir "$PROGRAMFILES\RBSoft\Sales Manager"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
!insertmacro CheckNetFramework 452

SetOutPath "$INSTDIR"
File "..\bin\Release\Sales Manager.exe"
CreateDirectory "$SMPROGRAMS\Sales Manager"
CreateShortCut "$SMPROGRAMS\Sales Manager\Sales Manager.lnk" "$INSTDIR\Sales Manager.exe"
CreateShortCut "$DESKTOP\Sales Manager.lnk" "$INSTDIR\Sales Manager.exe"
File "..\bin\Release\Sales Manager.exe.config"
File "..\bin\Release\Sales Manager.pdb"
File "..\bin\Release\License.txt"
File "..\bin\Release\Help.chm"
SetOutPath "$INSTDIR\x64"
File "..\bin\Release\x64\sqlite3.dll"
SetOutPath "$INSTDIR\x86"
File "..\bin\Release\x86\sqlite3.dll"
SectionEnd

Section -AdditionalIcons
SetOutPath $INSTDIR
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\Sales Manager\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\Sales Manager\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Sales Manager.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Sales Manager.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\x86\sqlite3.dll"
Delete "$INSTDIR\x64\sqlite3.dll"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\Help.chm"
Delete "$INSTDIR\Sales Manager.pdb"
Delete "$INSTDIR\Sales Manager.exe.config"
Delete "$INSTDIR\Sales Manager.exe"

Delete "$SMPROGRAMS\Sales Manager\Uninstall.lnk"
Delete "$SMPROGRAMS\Sales Manager\Website.lnk"
Delete "$DESKTOP\Sales Manager.lnk"
Delete "$SMPROGRAMS\Sales Manager\Sales Manager.lnk"

RMDir "$SMPROGRAMS\Sales Manager"
RMDir "$INSTDIR\x86"
RMDir "$INSTDIR\x64"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
2 changes: 2 additions & 0 deletions Sales Manager/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autoupdater.NET.Official" version="1.4.7" targetFramework="net452" />
<package id="Costura.Fody" version="1.6.2" targetFramework="net452" developmentDependency="true" />
<package id="Fody" version="2.0.0" targetFramework="net452" developmentDependency="true" />
<package id="Ix-Async" version="1.2.5" targetFramework="net452" />
<package id="Microsoft.Data.Sqlite" version="1.1.1" targetFramework="net452" />
<package id="Microsoft.EntityFrameworkCore" version="1.1.2" targetFramework="net452" />
Expand Down
55 changes: 55 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: 1.0.5.{build}
skip_branch_with_pr: true
image: Visual Studio 2017

# clone directory
clone_folder: c:\projects\SalesManager

# build platform, i.e. x86, x64, Any CPU. This setting is optional.
platform: Any CPU

# build Configuration, i.e. Debug, Release, etc.
configuration: Release

before_build:
- cmd: nuget restore

build:
verbosity: minimal

environment:
my_secret:
secure: pPM+5t4pxJs8OJlB/LrK32VzAn0hkgwa+MtPn/yGhLA=

install:
- nuget install secure-file -ExcludeVersion
- secure-file\tools\secure-file -decrypt "c:\projects\SalesManager\Sales Manager\Sales Manager.snk.enc" -secret %my_secret%

# NSIS Paths
# https://www.appveyor.com/docs/build-environment/#tools
- set PATH=%PATH%;C:\Program Files (x86)\NSIS;

# NSIS Plugin (NsisDotNetChecker)
- appveyor DownloadFile https://github.com/ReVolly/NsisDotNetChecker/archive/master.zip
- 7z e master.zip -o"C:\Program Files (x86)\NSIS\Include" DotNetChecker.nsh -r
- 7z e master.zip -o"C:\Program Files (x86)\NSIS\Plugins\x86-ansi" DotNetChecker.dll -r

after_build:
- cmd: 7z a Sales.Manager.Portable.zip "c:\projects\SalesManager\Sales Manager\bin\Release\"
- cmd: makensis.exe "c:\projects\SalesManager\Sales Manager\Setup\Sales Manager.nsi"

artifacts:
- path: Sales.Manager.Setup.exe
- path: Sales.Manager.Portable.zip

deploy:
release: $(APPVEYOR_REPO_TAG_NAME)
description: '// TODO: Writing Release Notes'
provider: GitHub
auth_token:
secure: WHW27Nvc8zNhfyhxIYdl/NwbrkFzvSX0vE4/CS8iByPXM6rcztWhUrDXJ7eejLBY
draft: false
prerelease: false
on:
branch: master # release from master branch only
appveyor_repo_tag: true # deploy on tag push only

0 comments on commit 3a0f94a

Please sign in to comment.