使用include的PublishOptions不适用于Debug Asp.net Core

时间:2017-01-25 06:29:19

标签: c# json asp.net-core

我在VisualStudio 2015中使用Asp.net核心版1.0.0-preview2-003131

奇怪的是,即使在appsettings.json中添加了publishOptions,它也不会在调试期间生成。但是,它将在发布版本中生成。

我使用Visual Studio进行编译和调试,而不是命令。

我的Project.json:

"publishOptions": {
  "include": [
    "appsettings.json"
  ]
}

更新 下面是我在Project.json中的BuildOptions:

"buildOptions": {
    "emitEntryPoint": true
},

即使添加"debugType": "full"也无法解决此问题

2 个答案:

答案 0 :(得分:1)

您可以尝试将appsettings.Production.json添加到此publishOptions数组中。

答案 1 :(得分:1)

这样做:

orderNr = self.getIFC_ProjectDetail(readFile, self.orderNrLineEdit.text())
custNr = self.getIFC_ProjectDetail(readFile, self.custNoLineEdit.text())
if len(custNr) == 0:
    custNr = "9999"
projManager = self.getIFC_ProjectDetail(readFile, self.projManagerLineEdit.text())
    drawer = self.getIFC_ProjectDetail(readFile, self.drawerLineEdit.text())

ifcFile = open(readFile, 'r')
csvFile = open(csvFileName, 'w')
lineTokens = []
csvFile.write("GUID;Type;UserText1;UserText2;UserText3;UserText4;UserText5;UserText6;UserText7;\n")
 for mainLine in ifcFile:
    if ("IFCSLAB" in line or "IFCWALLSTANDARDCASE" in line):
                if len(uID) > 0:
                    if uID == oldID:
                        uID = "ciao"
                    csvFile.write("{0};{1};{2};{3};{4};{5};{6};{7};{8};\n".format(uID, matType, orderNr, custNr, assPos, partPos, fab, projManager, drawer))
                    oldID = uID
                    uID = ""
                    matType = ""
                    assPos = ""
                    partPos = ""
                    fab = ""
                lineTokens = line.split(",")
                headerLine = line[0:line.find("'")]
                line = line[line.find("(") +1:len(line)]
                lineTokens = line.split(",")
                uID = lineTokens[0]
                uID = uID[1:len(uID)-1]
                matType = lineTokens[2]
                matType = matType[1:len(matType)-1] 
                floorName = lineTokens[4]
                floorName = floorName[1:len(matType)-1]
            if self.assPosLineEdit.text() in line:
                assPos = self.getIFC_EntityProperty(line, self.assPosLineEdit.text())
            if self.partPosLineEdit.text() in line:
                partPos = self.getIFC_EntityProperty(line, self.partPosLineEdit.text())
            if self.fabricatorLineEdit.text() in line:
                fab = self.getIFC_EntityProperty(line, self.fabricatorLineEdit.text())
        if i == progDlg.maximum():
            csvFile.write("{0};{1};{2};{3};{4};{5};{6};{7};{8};\n".format(uID, matType, orderNr, custNr, assPos, partPos, fab, projManager, drawer))
 ifcFile.close()
 csvFile.close()

def getIFC_EntityProperty(self, row, ifcKey):
    s = ""
    lineTokens = []
    if ifcKey in row:
        lineTokens = row.split(",")
        ifcTag = lineTokens[2]
        ifcTag = ifcTag[0:ifcTag.find("(")]
        #print(ifcTag)
        if len(ifcTag) > 1:
            s = row[row.find(ifcTag)+len(ifcTag)+2:row.rfind(',')-2]
    return s

  def getIFC_ProjectDetail(self, fileName, ifcKey):
    s = ""
    content = open(fileName, 'r')
    lineTokens = []
    for line in content:
        if ifcKey in line:
            lineTokens = line.split(",")
            ifcTag = lineTokens[2]
            ifcTag = ifcTag[0:ifcTag.find("(")]
            if len(ifcTag) > 1:
                s = line[line.find(ifcTag)+len(ifcTag)+2:line.rfind(',')-2]
                break
    content.close()
    return s

列出了发布时将包含的所有文件和文件夹。