Monday, October 2, 2017

Re-publish Web App to Azure from Visual Studio 2017

It's easy to download the published profile from the Azure portal if your application has already been published. Here is how you can download the publishing profile from the Azure portal and use that to publish your application from Visual Studio.

1. log in to the Azure dashboard and open-up the App service that you want to publish your application.



2. Download the publish profile.


3. Go to your Web application in Visual Studio and get the Publishing wizard.

4. Select Import Profile and click on Publish. You will be prompted to select the Imported Publish Setting File.

If you are connected with the Azure Subscription, you can use the server explorer panel to access the published files in case you need to alter any file contents without login into Kudu services.







Friday, June 2, 2017

View all Foreign Key Relationships in the Database

I've found some good directions from stack-overflow. Combining a few solutions, I could get the result that I wanted.

Query 1 :
SELECT RC.constraint_name AS ForeignKey,
       KF.table_name      AS TableName,
       KF.column_name     AS ColumnName,
       KP.table_name      AS ReferenceTableName,
       KP.column_name     PK_Column,
       RC.match_option    MatchOption,
       RC.update_rule     UpdateRule,
       RC.delete_rule     DeleteRule
FROM   information_schema.referential_constraints RC
       JOIN information_schema.key_column_usage KF
         ON RC.constraint_name = KF.constraint_name
       JOIN information_schema.key_column_usage KP
         ON RC.unique_constraint_name = KP.constraint_name 



Query 2 :
SELECT f.name AS ForeignKey,
   OBJECT_NAME(f.parent_object_id) AS TableName,
   COL_NAME(fc.parent_object_id, fc.parent_column_id) AS ColumnName,
   OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName,
   COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS ReferenceColumnName
FROM sys.foreign_keys AS f
INNER JOIN sys.foreign_key_columns AS fc
   ON f.OBJECT_ID = fc.constraint_object_id


Friday, January 27, 2017

Exclude files from getting compiled in Visual Studio Project Depending on the Platform Configuration

I had to include and maintain some SAP Business One system forms captured from each SAP Business One version (9.0, 9.1, and 9.2) for an SAP Business One Add-on Visual Studio project. Of course, I've tried with placing them in separate folders, but during the compilation of the source code, I've got this build error.



So, I thought of an out-of-the-box solution that could help me to compile my add-on project with only the source code files that are related to the SAP version and bit version. This was the summary of the R&D work that I did.

Problem : How can I explicitly exclude/include source code files in Visual Studio, depend on the Solution Configuration or Solution Platform.


Directions :
I've created a sample visual studio solution and added two empty classes.


Then I've opened up the ConsoleApplication1 project file using a text editor.


Then Noticed the usage of the Condition element and moved my Class1.cs and Class2.cs in to two separate item groups as below.



Now, When I switch the value to 32bit from the Solution platform, only Class1 is getting attached to the compiler.




Similarly, for 64bit, I only get Class2.




Since both Class1 and Class2 coexist in the solution at any time, this workaround will definitely help to get rid of build automation-related work, even if it's hard to maintain.