Unable to apply publish properties for item “ApplicationCode\SystemNames.xml”

Solved with thanks to:

http://stackoverflow.com/questions/9284375/unable-to-apply-publish-properties-for-item-x

“It appears that the issue is related to ClickOnce. Navigate to the project, right click on it and click on properties. Go to the Publish tab and click on Application Files. Check the ‘Show all files’ checkbox and scroll through the list of files. Eventually, you will come across the file that has a yellow exclamation point on it. This file is orphaned and needs to be removed. Right click on the file and there should be a remove option.

Now build the solution and the warning should be gone.”

Error: The multi-part identifier could not be bound. when using a function and alias

You cannot pass parameters to functions across a JOIN.

http://stackoverflow.com/questions/4123413/the-multi-part-identifier-columnname-could-not-be-bound

Use APPLY:

SELECT ROW_NUMBER() OVER(ORDER BY x.Year DESC, x.Month) AS ID,
x.*,
fr.*
FROM (
SELECT Client,
Month(TimeStamp) As Month,
Year(TimeStamp) As Year,
Day(TimeStamp) As Day,
(dateadd(yy,(Year(TimeStamp)-1900),0)
+ dateadd(mm,Month(TimeStamp)-1,0)
+ Day(TimeStamp)-1) AS XTimeStamp,
Sum(KwTop) As KwTop,
Sum(KwHeap) as KwHeap,
Sum(KwLow) As KwLow
FROM Ori.vEnergyUnion
GROUP BY
Year(TimeStamp), Month(TimeStamp),Day(TimeStamp), Client
) x
OUTER APPLY
(
SELECT *
FROM Finance.fGetRates(x.XTimeStamp) Fr
WHERE fr.ValidFrom = x.XTimeStamp
) fr

Visual Studio unable to copy file because it is being used by another process

 

To try and get around this I closed VS and re-opened it. Still the same problem. In this scenario I then closed it again and on inspection of Task Manager I found that devenv was still running as a process (it was not in Applications). After Killing this extra devenv my computer blue screened. After restarting itself I was able to open my solution and build.

Could not load file or assembly … or one of its dependencies. The module was expected to contain

Possibly the reference is an executable program. Solution is:

  1. Right-click on project not building properly – Project Build Order
  2. Check that the reference is higher in the list
  3. If not then use Dependencies tab to add the required dependency which changes the Build Order

Similar to http://wp.me/p17IS4-dh

 

Entity Framework – Inheritance/Association – including Troubleshooting and comment on verbose SQL

See this video on Model Table Per Type

http://msdn.microsoft.com/en-us/data/cc765425.aspx

  1. Update Model from Database – Add Table
  2. Right-click Entity Add Inheritance
  3. Error 11009: Property ‘<>’ is not mapped
  4. Right-click Entity > Table Mapping > re map missing
  5. Running transformation: A member named ID cannot be defined in class DerivedClass. It is defined in ancestor class ParentClass.
  6. Delete it from DerivedClass

Error 3027: No mapping specified for the following EntitySet/AssociationSet – TableATableB

Error 11008: Association TableATableB is not mapped
EF is not expecting both a Foreign Key relationship and an association, see note at top of: http://msdn.microsoft.com/en-us/library/bb738488.aspx
Delete the association

Existing queries may then break as the Entity type no longer exists. So in my case Products is base type PadMain inherits from this. Used to have PadMains now PadMain EntityName is Products, so query on PadMains needs to change. From/To:

From b In context.PadMains
From b in context.Products1.OfType(Of PadMain)()

However if PadMain has subtypes then the SQL generated is verbose. If table is separated out in SQL then you just want the base table. If a field will appear in multiple related child tables then you will get duplications. In this scenario this is a major disadvantage of Entity Framework. Hopefully it will be fixed in future. For now I have removed my inheritance.

The file or directory is corrupt and non-readable. (possibly in Visual Studio and TFS Build broke)

Problem found

<drive>:\<folder> is not accessible    The file or directory is corrupt and non-readable.The file or directory is corrupt and non-readable. The file or directory \<folder> is corrupt and unreadable.    Please Run the Chkdsk utility.

Was causing build to fail. Some how system had created a badly named file RoqteOpsData where the q should have been a u

Resolution

http://support.microsoft.com/kb/176646

Attempt to repair the damaged file, folder or file system index using Chkdsk. To do so, follow these steps:

  1. Click Start, and then click Run.
  2. In the Open box, type chkdsk /f <drive>:,   where <drive> is the letter of the drive on which the damaged file,   folder or file system index exists.
  3. Click OK.

Click-Once – The application binding data format is invalid

 

Remove files from %userprofile%\AppData\Local\Apps\2.0\

Deleting an ASP.Net azure hosted website using Entity Framework can potentially delete the linked database

I had a database on Azure that was being updated using Windows Forms. I then created an ASP.Net MVC application using EF to work against the same database. However I following a tutorial which used Code First

http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/

This would not publish until I used Nu-Get to:

enable-migrations

However I think I then used code first migrations on publish. However I published the website with high credentials and wanted to change the credentials to lower. Could not see how to do this in Azure, so deleted the website. At this point the database disappeared without warning.

This is why the last posts have been about SQL Azure backup. However recovered using on-site data and re-created database.

Microsoft support helped with the ASP.Net so:

enable-migrations

Check the file created, but do not check the box on publish.

Tested by deleting the Website – This then asked if you wanted to delete the linked database. Answer: No. Database stays ok.

ASP.Net MVC VB.Net Troubleshooting

Trouble

The connection name ‘ApplicationServices’ was not found in the applications configuration or the connection string is empty

Solution

Go to Project level web.config. Find <membership> change connectionStringName=”ApplicationServices” to “LocalSqlServer”

 

WPF freezes when dragging data source onto a Page or Window

Problem

WPF freezes when dragging data source onto a Page or Window

Possible Solution

Inspect datasource and see if it has a child table underneath it. Does this child expand to show the parent table again. If so then you may be creating an infinite loop when dragging the datasource onto the Page or Window