Setup of SA for .NET Winforms App (VB.NET)
pel
Posts: 4 New member
I am trialing SA right now, and have several questions.
1. For setup using an Obfuscator, I typically set the software's input assembly to the .exe in the \obj\Release folder, and then export (save) to the \bin\Release folder -- is this correct with SA? It seems to be working, since I could open the assembly once the app was installed and see that it was obfuscated.
2. I finally noticed your Nuget installation package, which is better than manual installation, since you don't have to modify the .vbproj file.
3. A particularly "nasty" exception that I have seen when using the app is when the app simply shuts down without raising any exceptions. Aren't those called "fatal" exception? Do you suppose that SA would identify those?
4. I just confirmed that SA was not obfuscating the app after I installed the setup & deployment package, and then opened the .exe with .NEt Reactor. Below are several of the last lines in the .vbproj file I noticed, which indicates some sort of instability after Nuget installation.
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.props'))" />
<Error Condition="!Exists('packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets'))" />
</Target>
<Import Project="packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets" Condition="Exists('packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets')" />
1. For setup using an Obfuscator, I typically set the software's input assembly to the .exe in the \obj\Release folder, and then export (save) to the \bin\Release folder -- is this correct with SA? It seems to be working, since I could open the assembly once the app was installed and see that it was obfuscated.
2. I finally noticed your Nuget installation package, which is better than manual installation, since you don't have to modify the .vbproj file.
3. A particularly "nasty" exception that I have seen when using the app is when the app simply shuts down without raising any exceptions. Aren't those called "fatal" exception? Do you suppose that SA would identify those?
4. I just confirmed that SA was not obfuscating the app after I installed the setup & deployment package, and then opened the .exe with .NEt Reactor. Below are several of the last lines in the .vbproj file I noticed, which indicates some sort of instability after Nuget installation.
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<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\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.props'))" />
<Error Condition="!Exists('packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets'))" />
</Target>
<Import Project="packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets" Condition="Exists('packages\RedGate.SmartAssembly.MSBuild.7.3.0.3296\build\RedGate.SmartAssembly.MSBuild.targets')" />
Tagged:
Answers
1,2. When using MSI or ClickOnce, msbuild will use the assembly it finds in the obj\Release folder as the assembly in the resulting installer.
Thus you will indeed need to use the obj\release assembly as the input assembly, and instruct SmartAssembly to overwrite the original obj\Release file with the obfuscated one. You can do this by adding the following to your csproj/vsproj file:
<SmartAssemblyOverwriteAssembly>true</SmartAssemblyOverwriteAssembly>
(for more information, see here for using the nuget package and here for manually adding the SA build task)
3. It should indeed catch fatal exceptions.
4. I think you can ignore this message in the vbproj, it looks like it's just a variable storing the message if needed, but the error isn't actually being thrown. Using SmartAssemblyOverwriteAssembly should ensure that the obfuscated assembly is used for the setup & deployment package.
Jessica Ramos | Product Support Engineer | Redgate Software
Have you visited our Help Center?