0

I hope it's not a duplicated question since I searched enough about it but I found nothing, maybe that's because I didn't know the appropriate words describing my situation.

The question:

Summary: Can Visual Studio build different editions of an ASP.Net Webform just by a simple wizard or something like that? Some Cs, Js Or Css files or some folders shouldn't be involved in the final output.

Detailed: We have had a very large ASP.Net project containing lots of folders and involving lots of features, we have been offering the whole project to customers and we have been protecting it by License approach (which applies Private and Public keys mechanism).

Now the company considers to offer different editions of the application based on the customer type, so if the customer is a small business it will be offered an application with less features since he is going to pay less money.

Keep in mind that we don't want to offer customers the complete application and then based on the permission which are defined in a table in the database he can get access to just the features we tend, It's no that good, beacuse after he are given the limited edition license, he is able to change his permission by modifying the related table in databadse or if he dissemble the related Cs or dll files (I have read about obfuscation to make it safer)

They wouldn't gain anything even if they grant required permissions complately to themselves beacuse they don't have required files.

I had hared of an application which is used to manage -or better to say customize- the project build process, what is the best solution? would you enlighten me?

Muhammad Musavi
  • 2,512
  • 2
  • 22
  • 35
  • You can use preprocessor (raw or as `[Conditional(...)]` or simply do not deploy some assemblies. That said... private/public key signature approach is almost useless if license server is deployed together with the application... – Adriano Repetti Dec 25 '17 at 08:55

2 Answers2

2

I would highly recomend you to look into build configurations in visual studio. There you can choose what project files to build and control the output.

Check out the following for more details: https://msdn.microsoft.com/en-us/library/kkz9kefa.aspx

IceCode
  • 1,466
  • 13
  • 22
0

I'm still looking for the best solution but for now, after searching a lot I found some solutions applying MsBuild, for instance to exclude some folders and some files from being published you can add following script in visual studio project file (.csproj):

<ItemGroup>
        <ExcludeFromPackageFolders Include="Scripts\large">
          <FromTarget>Project</FromTarget>
        </ExcludeFromPackageFolders> 


        <ExcludeFromPackageFiles Include="Scripts\mash.js.chirp.config"/>  
        <ExcludeFromPackageFiles Include="Content\mash.js.chirp.config"/>
</ItemGroup>

This will cause the following folder and files to be excluded:

Scripts\large
mash.js.chirp.config

You should add above script in .csproj xml config file exactly below the line which says:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

Here's some useful links: This one and This one

Keep in mind that there is no visual studio project file in Web site so you can apply it in Web application but Website, Here is the source from MSDN.

Although here it's told that you can use MSBuild even if it's about Website, Take a look at this link so you'll learn how to create a project file for that purpose.

Muhammad Musavi
  • 2,512
  • 2
  • 22
  • 35