我有一个带有单独的config.json文件的ASP.NET Core 2.2白色标签应用程序。我希望能够在调用dotnet publish(从VS Code)时排除此文件的部署,以免意外覆盖UAT和Prod设置。
使用ASP.NET,您可以在opti = tf.keras.optimizers.Adam(lr=0.00001)
batch = 100
mindelta = 0.0001
lr_red_factor = 0.4
acti = 'relu'
actilast = 'softmax'
kern = 'he_normal'
bias = 'zeros'
droprate = 0.4
target = 5
loss = 'sparse_categorical_crossentropy'#'mean_squared_error'
metrics = ['sparse_categorical_accuracy']
nodesperlayer = 30
howmanyhidden = 1
patience = (4000/(nodesperlayer*howmanyhidden))/batch
model = models.Sequential()
first = True
for _ in range(howmanyhidden):
if first:
model.add(layers.Dense(nodesperlayer, use_bias=True,
kernel_initializer=kern,
bias_initializer=bias,
input_dim=feats.columns.shape[0]))
first=False
else:
model.add(layers.Dense(nodesperlayer, use_bias=True,
kernel_initializer=kern,
bias_initializer=bias))
model.add(layers.BatchNormalization(axis=-1, momentum=0.99,
epsilon=0.001, center=True,
scale=True, beta_initializer='zeros',
gamma_initializer='ones',
moving_mean_initializer='zeros',
moving_variance_initializer='ones',
beta_regularizer=None,
gamma_regularizer=None,
beta_constraint=None,
gamma_constraint=None))
model.add(layers.Activation(acti))
model.add(layers.Dropout(droprate)) #todo seed?
model.add(layers.Dense(target, activation = actilast))
model.compile(loss=loss, metrics=metrics, optimizer=opti)
内添加<ExcludeFilesFromDeployment>
。我已经在.csproj文件中尝试过此操作,但它似乎无法正常工作,并且在asp.net核心文档中找不到对该元素的任何引用。根据{{3}}
在以前的Core版本中,您可以在project.json文件中使用publishExclude,但在2.2版中不存在
如何排除在dotnet上发布的文件?
答案 0 :(得分:1)
对于Asp.Net Core 2.2
,它使用MSBuild
来构建项目。
对于特定文件,您可以编辑*.csproj
,并在下面添加
<ItemGroup>
<Content Update="config.json" CopyToPublishDirectory="Never" />
</ItemGroup>